from math import sqrt

input = 53

def premiers(n):
  prem=list(range(2,n+1))
  k=2
  nRacine=sqrt(n)
  while k<nRacine:
    prem=[p for p in prem if p<=k or p%k!=0]
    k=prem[prem.index(k)+1]  # nouveau nombre premier
  return prem

p = premiers(100000)

k = 0
nb_prem = 0
while True:
    v = 34*k+35
    if v in p:
        nb_prem += 1
    if nb_prem == input:
        print(v,k)
        break
    k +=1