import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int p = 1; int res=0; for(int i=1; i<11; i++){ int k = N/p; if(k%10==7){ res += p; } p=p*10; } System.out.println(N-res+" "+res); } }