Codeforces Round 131 (Div. 2)
A
System of Equations
Codeforces
800
原题
←B →
翻译中…

Furik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark for math. For that Ms. Ivanova, his math teacher, gave him a new task. Furik solved the task immediately. Can you?

翻译中…

You are given a system of equations:

翻译中…

image

翻译中…

You should count, how many there are pairs of integers $(*a*, *b*)$ $(0 ≤ *a*, *b*)$ which satisfy the system.

翻译中…

Input

翻译中…

A single line contains two integers $*n*, *m*$ $(1 ≤ *n*, *m* ≤ 1000)$ — the parameters of the system. The numbers on the line are separated by a space.

翻译中…

Output

翻译中…

On a single line print the answer to the problem.

翻译中…

Note

翻译中…

In the first sample the suitable pair is integers $(3, 0)$. In the second sample the suitable pair is integers $(3, 5)$. In the third sample there is no suitable pair.

翻译中…

样例

Input #1
9 3
Output #1
1
InputCopy OutputCopy
Input #2
14 28
Output #2
1
InputCopy OutputCopy
Input #3
4 20
Output #3
0
InputCopy OutputCopy
题目信息
题号
214A
时间限制
2 s
内存限制
256 MB
标签
暴力

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