#ifndef ONLINE_JUDGE #define _GLIBCXX_DEBUG #endif #include "atcoder/all" #include #include #include #include #include #include // 任意長整数型 using Bint = boost::multiprecision::cpp_int; // 仮数部が10進数で1024桁の浮動小数点数型(TLEしたら小さくする) using BReal = boost::multiprecision::number>; using Rat = boost::rational; #include #include using namespace std; using namespace __gnu_pbds; // 型エイリアスの設定 template using ordered_set = tree, rb_tree_tag, tree_order_statistics_node_update>; using namespace atcoder; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T &a, T b) { return ((a>b) ? (a = b, true) : (false));} #define rep(i,s,n) for(int i=s;i<(int)(n);i++) //decrease rep(s以上, n未満) #define drep(i,s,n) for(int i=n-1;i>=s;i--) const long long inf = 1LL<<60; typedef long long ll; typedef long double ld; typedef __int128_t l3; //pairのsecondでソートsort(p.begin(),p.end(),cmp) #define cmp [](pair a, pair b){return a.second pi; typedef pair P; typedef pair > PP; #define vll vector #define vvll vector> #define vint vector #define vvint vector> #define vmint vector #define vvmint vector> #define vvch vector> #define vch vector #define vvpi vector> #define vpi vector #define pb push_back #define eb emplace_back #define YES cout<<"Yes"<istream& operator>>(istream& i, vector &v) { rep(j___, 0, size(v))i >> v[j___]; return i; } #define UNIQUE(x) sort(all(x)), x.erase(unique(all(x)), x.end()) int pc(ll x) { return __builtin_popcount(x); } //ビット列にどれだけ1がたっているかを求める pop count void cincout(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); cout<< fixed << setprecision(15); } bool out_grid(ll i, ll j, ll h, ll w) { return (!(0<=i && i> s; ll res = 0; int sign = 1; rep(i,0,s.size()) { if(s[i] == '-') sign*=-1; if(s[i] == '.') continue; res = res*10 + (s[i] - '0'); } return res*sign; } ll gcd(ll a, ll b) { if(b == 0) return a; if(a%b == 0) return b; return gcd(b,a%b); } using pl = pair; pl make(ll X) { pl res = {X, 10000}; ll g = gcd(abs(res.fi), abs(res.se)); res.fi /= g; res.se /= g; return res; } int main() { ll A = read(), B = read(); pl a = make(A), b = make(B); if(a.fi != 1 && a.se != 1) { NO return 0; } ll exp = (a.fi == 1 ? -1 : 1); { vint exps; ll cur = max(a.fi, a.se); for(int p=2;p<=10000;p++) { int cn = 0; while(cur%p == 0) cn++, cur/=p; if(cn) exps.pb(cn); } ll g = exps[0]; rep(i,0,exps.size()) g = gcd(g, exps[i]); exp *= g; } //指数部分はexp, exp*bが自然巣であればいい b.fi *= exp; if(b.fi%b.se == 0) YN return 0; }