import java.util.*; public class No543 { public static void main(String[] args) { try (final Scanner sc = new Scanner(System.in)) { int n = sc.nextInt(); Random random = new Random(); while (true) { int a = random.nextInt(2_000_000_001) - 1_000_000_000; int b = n - a; if (Math.abs(b) > 1_000_000_000) continue; if ((a+"").indexOf('7') < 0 && (b+"").indexOf('7') < 0) { System.out.println(a + " " + b); break; } } } } static long gcd(long n, long r) { return r == 0 ? n : gcd(r, n % r); } static long lcm(long n, long r) { return n/gcd(n,r)*r; } static void dump(Object... objects) { System.err.println(Arrays.deepToString(objects)); } }