#include using namespace std; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } int main() { fast_io(); string a, b; cin >> a >> b; if (b == "0.0000") { cout << "Yes" << endl; return 0; } int n = a.size(), m = b.size(); // a = p / q, b = r / s int p, q; { int p = stoi(a.substr(0, n - 5) + a.substr(n - 4, 4)); int q = 10000; int g = gcd(p, q); p /= g; q /= g; if (b[0] == '-') { swap(p, q); b = b.substr(1); } } int r = stoi(b.substr(0, m - 5) + b.substr(m - 4, 4)); int s = 10000 / gcd(r, 10000); if (a.substr(n - 5, 5) != ".0000") { cout << "No" << endl; return 0; } int A = stoi(a.substr(0, n - 5)); vector> pf; for (int i = 2; i * i <= A; i++) { if (A % i == 0) { int cnt = 0; while (A % i == 0) { A /= i; cnt++; } pf.push_back({i, cnt}); } } if (A > 1) { pf.push_back({A, 1}); } for (auto [_, cnt] : pf) { if (cnt % s != 0) { cout << "No" << endl; return 0; } } cout << "Yes" << endl; }