#potęgowanie binarne (left-to-right) def potegowanie(x, k): y = 1 while k > 0: if k & 1: y = y*x x = x**2 k = k >> 1 return y def potegowanieimod(x, k, n): y = 1 while k > 0: if k & 1: y = y*x % n x = x**2 % n k = k >> 1 return y wynik = potegowanieimod(557447646341221346636192772896901610558710893835414944403480118710131817164269282839046936145176310843035027195369552947724772574976124889744487830405662539681582010111238770266408227840530530562128937575104894419356210796751265695974980542800695284666417470596597594320307059087588663353662759831096, 6262263371377541559141206895621884814807915303145516042650825916222136098970293814810224532254572606923485012865464653542596037422501455912488470111758490086095137370045391054577237580171284636282615725496568360590261691887179088064684821943355507214597667739684622993519703639685862165456606534344947, 12603105321135622767305477321226264526101452611580750172942995573642583834115518597214611628755756515637031503762433821635382941259415596191772792339558820602095032907912585193142776570851767147616224169462438014704841831725007609378775100884540643665648152752437883986935155645486418494891325614905908) if wynik == 5999094661563003763568151773868137137878551943868313644708609682354664804445417731065849088949097475986000148641869282547289131404075798592274418987346555863193991175013972255255302184349784703771765294091989135154969897917024913262973652830513067145466227133548941154196707964903756614122209256595084: print("ok")