#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int MOD = 1e9 + 7;
const int dx[] = {0, 0, 1, -1};
const int dy[] = {1, -1, 0, 0};
const char dir[] = {'R', 'L', 'D', 'U'};
ll add(ll a, ll b) {
  a += b;
  if (a >= MOD) {
    a -= MOD;
  }
  return a;
}
int sub(int a, int b) {
  a -= b;
  if (a < 0) a += MOD;
  return a;
}
int mult(int a, int b) { return ((ll)a * b) % MOD; }
void setIO() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
}
int main() {
  setIO();
  int a, b;
  cin >> a >> b;
  int n = a + b;
  int ans = 0;
  for (int i = 1, next; i <= n; i = next) {
    int groups = n / i;
    next = n / groups + 1;
    int alo = (a + groups) / (groups + 1);
    int ahi = a / groups;
    int blo = (b + groups) / (groups + 1);
    int bhi = b / groups;
    if (alo > ahi || blo > bhi) continue;
    ans += max(0, min(next - 1, ahi + bhi) - max(i, alo + blo) + 1);
  }
  cout << ans << "\n";
}

### 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>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int MOD = 1e9 + 7;
const int dx[] = {0, 0, 1, -1};
const int dy[] = {1, -1, 0, 0};
const char dir[] = {'R', 'L', 'D', 'U'};
ll add(ll a, ll b) {
  a += b;
  if (a >= MOD) {
    a -= MOD;
  }
  return a;
}
int sub(int a, int b) {
  a -= b;
  if (a < 0) a += MOD;
  return a;
}
int mult(int a, int b) { return ((ll)a * b) % MOD; }
void setIO() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
}
int main() {
  setIO();
  int a, b;
  cin >> a >> b;
  int n = a + b;
  int ans = 0;
  for (int i = 1, next; i <= n; i = next) {
    int groups = n / i;
    next = n / groups + 1;
    int alo = (a + groups) / (groups + 1);
    int ahi = a / groups;
    int blo = (b + groups) / (groups + 1);
    int bhi = b / groups;
    if (alo > ahi || blo > bhi) continue;
    ans += max(0, min(next - 1, ahi + bhi) - max(i, alo + blo) + 1);
  }
  cout << ans << "\n";
}

```