#include #define rep(i,n) for(int i=(0);i<(n);i++) using namespace std; typedef long long ll; typedef unsigned long long ull; int main(){ cin.tie(0); ios::sync_with_stdio(false); string s; cin >> s; int n = s.size(); ll a = 0, b = 0; rep(i, n){ a *= 10; b *= 10; int x = s[i] - '0'; if(x == 7){ a += 1; b += 6; }else{ b += x; } } cout << a << " " << b << endl; }