Codeforces Round 122 (Div. 2)
A
Exams
Codeforces
900
原题
←B →
翻译中…

One day the Codeforces round author sat exams. He had $*n*$ exams and he needed to get an integer from $2$ to $5$ for each exam. He will have to re-sit each failed exam, i.e. the exam that gets mark $2$.

翻译中…

The author would need to spend too much time and effort to make the sum of his marks strictly more than $*k*$. That could have spoilt the Codeforces round. On the other hand, if the sum of his marks is strictly less than $*k*$, the author's mum won't be pleased at all.

翻译中…

The Codeforces authors are very smart and they always get the mark they choose themselves. Also, the Codeforces authors just hate re-sitting exams.

翻译中…

Help the author and find the minimum number of exams he will have to re-sit if he passes the exams in the way that makes the sum of marks for all $*n*$ exams equal exactly $*k*$.

翻译中…

Input

翻译中…

The single input line contains space-separated integers $*n*$ and $*k*$ ($1 ≤ *n* ≤ 50$, $1 ≤ *k* ≤ 250$) — the number of exams and the required sum of marks.

翻译中…

It is guaranteed that there exists a way to pass $*n*$ exams in the way that makes the sum of marks equal exactly $*k*$.

翻译中…

Output

翻译中…

Print the single number — the minimum number of exams that the author will get a $2$ for, considering that the sum of marks for all exams must equal $*k*$.

翻译中…

Note

翻译中…

In the first sample the author has to get a $2$ for all his exams.

翻译中…

In the second sample he should get a $3$ for two exams and a $2$ for two more.

翻译中…

In the third sample he should get a $3$ for one exam.

翻译中…

样例

Input #1
4 8
Output #1
4
InputCopy OutputCopy
Input #2
4 10
Output #2
2
InputCopy OutputCopy
Input #3
1 3
Output #3
0
InputCopy OutputCopy
题目信息
题号
194A
时间限制
2 s
内存限制
256 MB
标签
模拟
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。