#include <stdio.h>
int main(){
    int a=0,c,temp,len=1;
    scanf("%d",&c);
    temp=c;
    temp/=10;
    while(temp){
        len*=10;
        temp/=10;
    }
    while(len){
        if((c/len)%10==7)a+=len;
        len/=10;
    }
    printf("%d %d\n",a,c-a);
}