from pwn import *
from Crypto.Util.number import *

def findN() :
    c=[2,3,5,7]
    e=65537
    nl=[]
    for i in range(4) :
        nl.append(encrypt(c[i]))
    gcd =nl[0]
    for i in range(1,4) :
        gcd=GCD(gcd,nl[i])

    return gcd

def encrypt(m) :
    r=process("./run.sh")
    r.recvuntil("choice: ")
    r.sendline("1")
    r.recv()
    r.sendline("0"+str(m))
    r.recvuntil("ciphertext (in hex): ', '")
    c=r.recvuntil("'")[:-1]
    return int(c,16)


if __name__ =="__main__" :
    print findN()



