from pwn import *

context.log_level = "info"

p = remote("192.168.0.221", 20500, timeout=5)
p.recvuntil(b"x> ")

p.sendline(b"2")
y1 = int(p.recvline().strip().removeprefix(b"x> "))

p.recvuntil(b"x> ")

p.sendline(b"3")
y2 = int(p.recvline().strip().removeprefix(b"x> "))

print(3 * y1 - 2 * y2)

p = abs(3 * y1 - 2 * y2)
inv2 = pow(2, -1, p)
flag_int = (y1 * inv2) % p

print(flag_int)
