#include using namespace std; long long pow(long long b, long long e) { long long ret = 1; while(e) { if(e & 1) ret *= b; b *= b; e >>= 1; } return ret; } int main() { string A, B; cin >> A >> B; long long AI = stoi(A.substr(0, A.size() - 5)); long long AD = stoi(A.substr(A.size() - 4)); long long BI = stoi(B.substr(0, B.size() - 5)); long long BD = stoi(B.substr(B.size() - 4)); if(BI == 0 && BD == 0) { cout << "Yes\n"; return 0; } if(BI < 0) { BI *= -1; if(10000 % (10000 * AI + AD) != 0) { cout << "No\n"; return 0; } AI = 10000 / (10000 * AI + AD); AD = 0; } if(AD != 0) { cout << "No\n"; return 0; } for(long long i = 0; i <= 10000; i++) { if(i * BD % 10000 == 0) { for(long long j = 0; j <= AI; j++) { if(AI < pow(j, i)) break; if(AI == pow(j, i)) { cout << "Yes\n"; return 0; } } } } cout << "No\n"; return 0; }