1. 
/**
* FWP: Ausgewaehlte Probleme aus dem ACM (SS10)
*
* Method: number theory
* Problem: 10394 - Twin Primes
* Accepted: 0.972
* @author Evgeni Pavlidis
*
*/

import java.io.*;
import java.util.*;

class Main {

private static int MAX = 20000000;
private static int HIGH = 312500;

private static long FULL = 0xFFFFFFFFFFFFFFFFl;
private static long MASK = 0x000000000000003Fl;

// Bitmap of numbers.
// isPrime[0] holds bitwise info for the numbers 0 - 63
// isPrime[1] for 64 - 127 and so on
private static long isPrime[] = new long[HIGH+1];
private static int twinPrime[] = new int[1000001];


private static void sievePrimes()
{
for(int i = 0; i <= HIGH; i++)
isPrime[i] = FULL;

for(int i = 4; i <= MAX; i+=2)
isPrime[i >> 6] &= ~(1l << (i & MASK));

for(int i = 3; i <= Math.sqrt(MAX); i+=2)
if((isPrime[i >> 6] & (1l << (i & MASK))) != 0)
for(int j = i+i; j <= MAX; j+=i)
isPrime[j >> 6] &= ~(1l << (j & MASK)) ;
}

private static void findTwinPrimes()
{
int count = 1;
for(int i = 3; i < MAX-2; i+=2)
if( ( (isPrime[ i >> 6] & (1l << ( i & MASK))) != 0) &&
( (isPrime[(i+2) >> 6] & (1l << ((i+2) & MASK))) != 0) )
twinPrime[count++] = i;
}

public static void main(String...args) throws Exception
{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

sievePrimes();
findTwinPrimes();

String input;
int n;
while( (input = reader.readLine()) != null)
{
n = Integer.parseInt(input);
System.out.println("(" + twinPrime[n] + ", " + (twinPrime[n]+2)+ ")");
}
}
}