#include using namespace std; using i64 = int_fast64_t; #define rep(i, N) for(int (i) = 0; (i) < (N); (i)++) #define all(v) (v).begin(), (v).end() #define eb emplace_back int main(){ int A,B; cin >> A >> B; int L = lcm(A, B); cout << L - L/A - L/B + L/(A+B) << endl; }