#include <bits/stdc++.h>
template <class... Args>
inline __attribute__((always_inline)) void read(Args&... args) {
  (std::cin >> ... >> args);
}
template <class... Args>
inline __attribute__((always_inline)) void write(Args&&... args) {
  (std::cout << ... << std::forward<Args>(args));
}
template <class... Args>
inline __attribute__((always_inline)) void writeln(Args&&... args) {
  write(std::forward<Args>(args)..., '\n');
}
inline __attribute__((always_inline)) void flush_write() {
  std::flush(std::cout);
}
int main() {
  std::ios_base::sync_with_stdio(false);
  std::fixed(std::cout).precision(20);
  std::cin.exceptions(std::ios_base::failbit);
  std::cin.tie(nullptr);
  int64_t a, b;
  read(a, b);
  int64_t n = a + b;
  int64_t res = 0;
  for (int64_t kl = 1, kr; kl <= n; kl = kr + 1) {
    int64_t tp = n / kl;
    kr = n / tp;
    if (tp > a || tp > b) continue;
    int64_t mn_a = (a + tp) / (tp + 1);
    int64_t mn_b = (b + tp) / (tp + 1);
    int64_t mx_a = a / tp;
    int64_t mx_b = b / tp;
    if (mn_a > mx_a || mn_b > mx_b) continue;
    int64_t mn = mn_a + mn_b;
    int64_t mx = mx_a + mx_b;
    if (mn < kl) mn = kl;
    if (kr < mx) mx = kr;
    res += std::max((int64_t)0, mx - mn + 1);
  }
  writeln(res);
  return 0;
}

### Prompt

Your challenge is to write a Cpp solution to 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>
template <class... Args>
inline __attribute__((always_inline)) void read(Args&... args) {
  (std::cin >> ... >> args);
}
template <class... Args>
inline __attribute__((always_inline)) void write(Args&&... args) {
  (std::cout << ... << std::forward<Args>(args));
}
template <class... Args>
inline __attribute__((always_inline)) void writeln(Args&&... args) {
  write(std::forward<Args>(args)..., '\n');
}
inline __attribute__((always_inline)) void flush_write() {
  std::flush(std::cout);
}
int main() {
  std::ios_base::sync_with_stdio(false);
  std::fixed(std::cout).precision(20);
  std::cin.exceptions(std::ios_base::failbit);
  std::cin.tie(nullptr);
  int64_t a, b;
  read(a, b);
  int64_t n = a + b;
  int64_t res = 0;
  for (int64_t kl = 1, kr; kl <= n; kl = kr + 1) {
    int64_t tp = n / kl;
    kr = n / tp;
    if (tp > a || tp > b) continue;
    int64_t mn_a = (a + tp) / (tp + 1);
    int64_t mn_b = (b + tp) / (tp + 1);
    int64_t mx_a = a / tp;
    int64_t mx_b = b / tp;
    if (mn_a > mx_a || mn_b > mx_b) continue;
    int64_t mn = mn_a + mn_b;
    int64_t mx = mx_a + mx_b;
    if (mn < kl) mn = kl;
    if (kr < mx) mx = kr;
    res += std::max((int64_t)0, mx - mn + 1);
  }
  writeln(res);
  return 0;
}

```