#include #include int gcd(int a, int b) { if (a == 0) return b; else return gcd(b % a, a); } typedef struct { int numer, denom; } ratio; void reduce_ratio(ratio *a) { int g = gcd(abs(a->numer), abs(a->denom)); a->numer /= g; a->denom /= g; if (a->denom < 0) { a->numer *= -1; a->denom *= -1; } } int is_integer_ratio(ratio a) { reduce_ratio(&a); if (a.denom == 1) return 1; else return 0; } int main() { char A[15], B[15]; scanf("%s", A); scanf("%s", B); int i; ratio a, b; for (i = 0, a.numer = 0; A[i] != '.'; i++) a.numer = a.numer * 10 + A[i] - '0'; for (i++; A[i] != 0; i++) a.numer = a.numer * 10 + A[i] - '0'; a.denom = 10000; for (i = (B[0] == '-')? 1: 0, b.numer = 0; B[i] != '.'; i++) b.numer = b.numer * 10 + B[i] - '0'; for (i++; B[i] != 0; i++) b.numer = b.numer * 10 + B[i] - '0'; b.denom = 10000; if (B[0] == '-') { a.denom ^= a.numer; a.numer ^= a.denom; a.denom ^= a.numer; } reduce_ratio(&a); reduce_ratio(&b); long long l, r, m; while (b.denom % 2 == 0) { b.denom /= 2; l = 1; r = a.numer; while (l < r) { m = (l + r) / 2; if (m * m < a.numer) l = m + 1; else r = m; } if (l * l == a.numer) a.numer = l; else { printf("No\n"); return 0; } l = 1; r = a.denom; while (l < r) { m = (l + r) / 2; if (m * m < a.denom) l = m + 1; else r = m; } if (l * l == a.denom) a.denom = l; else { printf("No\n"); return 0; } } while (b.denom % 5 == 0) { b.denom /= 5; l = 1; r = a.numer; while (l < r) { m = (l + r) / 2; if ((__int128)m * m * m * m * m < a.numer) l = m + 1; else r = m; } if (l * l == a.numer) a.numer = l; else { printf("No\n"); return 0; } l = 1; r = a.denom; while (l < r) { m = (l + r) / 2; if ((__int128)m * m * m * m * m < a.denom) l = m + 1; else r = m; } if (l * l == a.denom) a.denom = l; else { printf("No\n"); return 0; } } printf("Yes\n"); fflush(stdout); return 0; }