#include int check_7(int n){ while(n > 0){ if(n % 10 == 7){ return 1; } n /= 10; } return 0; } int main(){ int n; scanf("%d",&n); int a = n,b = 0; while(check_7(a)&&check_7(b)){ a++; b--; } printf("%d %d\n",a,b); return 0; }