#include #include using namespace std; int main() { int n,a,b; cin >> n; a = n/2; b = n-a; int A,B; A = a; B = b; for(int i = 1;i < 1000000000;i*=10){ if(A/i == 0 && B/i == 0)break; if((A/i)%10 == 7){ A-=i; B= n-A; } if((B/i)%10 == 7){ B-=i; A=n-B; } if((A/i)%10 == 7){ A-=i; B= n-A; } if((B/i)%10 == 7){ B-=i; A=n-B; } printf("%d %d\n",(A/i)%10,(B/i)%10); a=A; b=B; } printf("%d %d\n",a,b); return 0; }