#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; do{ a++; b--; }while(check_7(a) == 0 &&check_7(b) == 0); printf("%d %d\n",a,b); return 0; }