#include #include #include #include #include #include #include #include #include #include using namespace std; struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<ostream &operator<<(ostream &o,const vector&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")< diviser(int n) { vector d(n); for (int i=2; i<=n; i++) { if (n % i == 0) { d[i] = true; while(n % i == 0) n/=i; } } if (n != 1) d[n] = true; return d; } int main() { int a,b; cin >> a >> b; vector diva = diviser(a); vector divb = diviser(b); if (a == 1 || b == 1) { cout << 0 << endl; return 0; } for (int i=2; i dp(10000,false); dp[0] = true; for (int i=a; i<10000; i++) dp[i] = dp[i] || dp[i-a]; for (int i=b; i<10000; i++) dp[i] = dp[i] || dp[i-b]; int ans = 0; for (int i=0; i<10000; i++) if (!dp[i]) ans++; cout << ans << endl; }