import java.util.*; public class No543 { public static void main(String[] args) { try (final Scanner sc = new Scanner(System.in)) { long n = sc.nextInt(); Random random = new Random(); while (true) { long a = random.nextInt(); long b = n - a; 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)); } }