codeforces#P1202F. You Are Given Some Letters...

You Are Given Some Letters...

Description

You are given aa uppercase Latin letters 'A' and bb letters 'B'.

The period of the string is the smallest such positive integer kk that si=si mod ks_i = s_{i~mod~k} (00-indexed) for each ii. Note that this implies that kk won't always divide a+b=sa+b = |s|.

For example, the period of string "ABAABAA" is 33, the period of "AAAA" is 11, and the period of "AABBB" is 55.

Find the number of different periods over all possible strings with aa letters 'A' and bb letters 'B'.

The first line contains two integers aa and bb (1a,b1091 \le a, b \le 10^9) — the number of letters 'A' and 'B', respectively.

Print the number of different periods over all possible strings with aa letters 'A' and bb letters 'B'.

Input

The first line contains two integers aa and bb (1a,b1091 \le a, b \le 10^9) — the number of letters 'A' and 'B', respectively.

Output

Print the number of different periods over all possible strings with aa letters 'A' and bb letters 'B'.

Samples

输入数据 1

2 4

输出数据 1

4

输入数据 2

5 3

输出数据 2

5

Note

All the possible periods for the first example:

  • 33 "BBABBA"
  • 44 "BBAABB"
  • 55 "BBBAAB"
  • 66 "AABBBB"

All the possible periods for the second example:

  • 33 "BAABAABA"
  • 55 "BAABABAA"
  • 66 "BABAAABA"
  • 77 "BAABAAAB"
  • 88 "AAAAABBB"

Note that these are not the only possible strings for the given periods.