#include <bits/stdc++.h>
using namespace std;
namespace Fread {
const int MAXN = 1 << 20;
char buf[MAXN], *S, *T;
inline char getchar() {
  if (S == T) {
    T = (S = buf) + fread(buf, 1, MAXN, stdin);
    if (S == T) return EOF;
  }
  return *S++;
}
}  // namespace Fread
inline int read() {
  int f = 1, x = 0;
  char ch = Fread::getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = Fread::getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = Fread::getchar();
  }
  return x * f;
}
inline long long readll() {
  long long f = 1, x = 0;
  char ch = Fread::getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = Fread::getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = Fread::getchar();
  }
  return x * f;
}
int main() {
  int a = read(), b = read(), n = a + b;
  long long ans = 0;
  for (int i = 1, j; i <= n; i = j + 1) {
    j = n / (n / i);
    int g = n / i;
    assert(g == n / j);
    int a_min = a / (g + 1) + (a % (g + 1) != 0);
    int a_max = a / g;
    int b_min = b / (g + 1) + (b % (g + 1) != 0);
    int b_max = b / g;
    if (a_min > a_max || b_min > b_max) continue;
    ans += min(j, a_max + b_max) - max(i, a_min + b_min) + 1;
  }
  cout << ans << endl;
  return 0;
}

### Prompt

In CPP, your task is to solve the following problem:

You are given a uppercase Latin letters 'A' and b letters 'B'.

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

For example, the period of string "ABAABAA" is 3, the period of "AAAA" is 1, and the period of "AABBB" is 5.

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

Input

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

Output

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

Examples

Input


2 4


Output


4


Input


5 3


Output


5

Note

All the possible periods for the first example: 

  * 3 "BBABBA" 
  * 4 "BBAABB" 
  * 5 "BBBAAB" 
  * 6 "AABBBB" 



All the possible periods for the second example: 

  * 3 "BAABAABA" 
  * 5 "BAABABAA" 
  * 6 "BABAAABA" 
  * 7 "BAABAAAB" 
  * 8 "AAAAABBB" 



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

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
namespace Fread {
const int MAXN = 1 << 20;
char buf[MAXN], *S, *T;
inline char getchar() {
  if (S == T) {
    T = (S = buf) + fread(buf, 1, MAXN, stdin);
    if (S == T) return EOF;
  }
  return *S++;
}
}  // namespace Fread
inline int read() {
  int f = 1, x = 0;
  char ch = Fread::getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = Fread::getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = Fread::getchar();
  }
  return x * f;
}
inline long long readll() {
  long long f = 1, x = 0;
  char ch = Fread::getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = Fread::getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = Fread::getchar();
  }
  return x * f;
}
int main() {
  int a = read(), b = read(), n = a + b;
  long long ans = 0;
  for (int i = 1, j; i <= n; i = j + 1) {
    j = n / (n / i);
    int g = n / i;
    assert(g == n / j);
    int a_min = a / (g + 1) + (a % (g + 1) != 0);
    int a_max = a / g;
    int b_min = b / (g + 1) + (b % (g + 1) != 0);
    int b_max = b / g;
    if (a_min > a_max || b_min > b_max) continue;
    ans += min(j, a_max + b_max) - max(i, a_min + b_min) + 1;
  }
  cout << ans << endl;
  return 0;
}

```