#include <iostream>
#include <vector>
#include <stdio.h>
using namespace std;
unsigned np[313000];

// 0000001000000 
//     ^
//     10000000
void set(int i){
  np[i/64]|=1 << ((i%64) /2);
}

bool get(int i){
  // np[i/64] =            0000111010111000
  //(1 << ((i%64) /2));    0000000001000000
  return np[i/64] & (1 << ((i%64) /2));
}


int main(){
  for (int i = 3; i <= 4472; i+=2){
    if (!get(i)){
      int t = i*2;
      for (int j = i*3; j <= 20000000; j+=t)
        set(j);
    }
  }
  vector<int> v;
  v.push_back(0);
  v.push_back(3);
  v.push_back(5);
  int t = 0;
  while (v.size() <= 100000){
    if (!get(t+7) && !get(t+9)) v.push_back(t+7);
    if (!get(t+9) && !get(t+11)) v.push_back(t+9);
    if (!get(t+11) && !get(t+13)) v.push_back(t+11);
    t+=10;
  }
  while (scanf("%d",&t)!=EOF){
    printf("(%d, %d)\n",v[t],v[t]+2);
  }
}


