from hashlib import sha256
from random import randint

p = 508060885611577330181155708485373498616429791264000703
r = randint(1 << 1023, 1 << 1024) % p

coeffs = [randint(1 << 15, 1 << 16) for _ in range(7)]
print(coeffs)

f_r = sum(c * pow(r, i+1, p) for i, c in enumerate(coeffs)) % p
nonce = randint(0, 2**120)

flag = "HZU18{" + sha256(str(coeffs[0]).encode()+str(nonce).encode()).hexdigest()[:32] + "}"

with open("public.txt", "w") as f:
    f.write(f"p = {p}\n")
    f.write(f"r = {r}\n")
    f.write(f"f_r = {f_r}\n")
    f.write(f"_nonce = {pow(nonce, 128, p)}\n")

