#include <bits/stdc++.h>   int m(int a) {     int ret = 0, i = 1;     while (a > 0) {       if (a % 10 == 4 || a % 10 == 7) {         ret += (i * (a % 10)), i *= 10;       }       a /= 10;     }     return ret;   }   int main() {     int a, b;     while (scanf( %d%d , &a, &b) != EOF) {       while (1) {         a++;         if (m(a) == b) {           printf( %d n , a);           return 0;         }       }     }   }   