#include using namespace std; #define FOR(i,m,n) for(int i=(m);i<(n);++i) #define REP(i,n) FOR(i,0,n) using ll = long long; constexpr int INF = 0x3f3f3f3f; constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL; constexpr double EPS = 1e-8; constexpr int MOD = 998244353; // constexpr int MOD = 1000000007; constexpr int DY4[]{1, 0, -1, 0}, DX4[]{0, -1, 0, 1}; constexpr int DY8[]{1, 1, 0, -1, -1, -1, 0, 1}; constexpr int DX8[]{0, -1, -1, -1, 0, 1, 1, 1}; template inline bool chmax(T& a, U b) { return a < b ? (a = b, true) : false; } template inline bool chmin(T& a, U b) { return a > b ? (a = b, true) : false; } struct IOSetup { IOSetup() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << fixed << setprecision(20); } } iosetup; template std::vector prime_sieve(const int n) { std::vector smallest_prime_factor(n + 1), prime; std::iota(smallest_prime_factor.begin(), smallest_prime_factor.end(), 0); for (int i = 2; i <= n; ++i) { if (smallest_prime_factor[i] == i) [[unlikely]] prime.emplace_back(i); for (const int p : prime) { if (i * p > n || p > smallest_prime_factor[i]) break; smallest_prime_factor[i * p] = p; } } return GETS_ONLY_PRIME ? prime : smallest_prime_factor; } template std::vector> prime_factorization(T n) { std::vector> res; for (T i = 2; i * i <= n; ++i) { if (n % i == 0) [[unlikely]] { int exponent = 0; for (; n % i == 0; n /= i) { ++exponent; } res.emplace_back(i, exponent); } } if (n > 1) res.emplace_back(n, 1); return res; } pair normalize(string s) { s.erase(prev(s.end(), 5)); const ll num = stoll(s), den = 10000, g = gcd(num, den); return {num / g, den / g}; } int main() { string a, b; cin >> a >> b; auto [num_a, den_a] = normalize(a); auto [num_b, den_b] = normalize(b); if (num_b < 0) { swap(num_a, den_a); num_b = -num_b; } if (den_a != 1) { cout << "No\n"; return 0; } if (num_a == 1) { cout << (den_b == 1 ? "Yes\n" : "No\n"); return 0; } int ex = 0; for (const int v : prime_factorization(num_a) | ranges::views::values) { ex = gcd(ex, v); } cout << (ex % den_b == 0 ? "Yes\n" : "No\n"); return 0; }