Rating:

When I send a mod p to server,then I'll got a enc,then I got this:

flag = a1*p**0 + a2*p**1 + ...

enc = a1 + a2 + ...

So

flag - enc = a2*(p-1) + a3*(p**2-1) + ... = 0 mod (p-1)

So when I got enough enc, I can use Chinese remainder theorem(CRT) get flag

ps = list(range(3,257))

encs = [get_from_remote(i) for i in ps]

flag = crt(encs,[i-1 for i in ps])

long_to_bytes(flag)