Rating:

```
def egcd(a, b):
if a == 0:
return (b, 0, 1)
else:
g, y, x = egcd(b % a, a)
return (g, x - (b // a) * y, y)
def modinv(a, m):
g, x, y = egcd(a, m)
if g != 1:
raise Exception('modular inverse does not exist')
else:
return x % m

r = open('enc.txt','rb')
cipher = r.read().split('\n')

n = 20473673450356553867543177537
p = 2165121523231
q = 9456131321351327
e = 17
d = modinv(e,(p-1)*(q-1))
flag = ''

for x in cipher:

m = pow(int(x),d,n)
flag += chr(m)
if chr(m) == '}':
break

print 'flag is :%s' % flag
```