namespace AtCoder; #nullable enable using System.Numerics; static class Extensions { public static T[] Repeat(this int time, Func F) => Enumerable.Range(0, time).Select(_ => F()).ToArray(); public static long Root(this long x, int root = 2) { var limits = new long[] { 0, 0, 3037000500L, 2097152, 55109, 6209, 1449, 512, 235, 128, 79, 53, 39 }; if (x < 0 || root < 2 || root >= limits.Length) throw new Exception("not supported"); var pass = 0L; var fail = limits[root]; while (fail - pass > 1) { var middle = (fail + pass) >> 1; var next = 1L; for (var i = 0; i < root; i++) next *= middle; if (next <= x) pass = middle; else fail = middle; } return pass; } } class AtCoder { object? Solve() { var d = 10000L; static long GCD(long x, long y) => y == 0 ? x : GCD(y, x % y); var ad = Input(); var bd = Input(); if ((long)bd == 0) return true; var ap = (long)(ad * d); var aq = d; if (bd < 0) (ap, aq) = (aq, ap); if (aq != GCD(ap, aq)) return false; if (ap % d != 0) return false; var bp = (long)(bd * d); var div = GCD(Math.Abs(bp), d); var bq = d / div; if (bq == 1) return true; if (bq > 10) return false; var r = Extensions.Root(ap, (int)bq); var o = 1L; for (var i = 0; i < bq; i++) o *= r; return o == ap; } public static void Main() => new AtCoder().Run(); public void Run() { var res = Solve(); if (res != null) { if (res is bool yes) res = yes ? "Yes" : "No"; sw.WriteLine(res); } sw.Flush(); } string[] input = Array.Empty(); int iter = 0; readonly StreamWriter sw = new(Console.OpenStandardOutput()) { AutoFlush = false }; string String() { while (iter >= input.Length) (input, iter) = (Console.ReadLine()!.Trim().Split(' '), 0); return input[iter++]; } T Input() where T : IParsable => T.Parse(String(), null); int Int() => Input(); void Out(object? x, string? separator = null) { separator ??= Environment.NewLine; if (x is System.Collections.IEnumerable obj and not string) { var firstLine = true; foreach (var item in obj) { if (!firstLine) sw.Write(separator); firstLine = false; sw.Write(item); } } else sw.Write(x); sw.WriteLine(); } }