#include int n, c1,c2, t, c, p; int main() { while(1) { scanf("%d%d%d", &n, &c1, &c2); if(n == 0 && c1 == 0 && c2 == 0) break; t = 0; p = 1; if(n == c1) { printf("%d\n", c1); continue; } while(n != 0) { c = n % 10; n /= 10; if(c == c1) t = p * c2 + t; else t = p * c + t; p *= 10; } printf("%d\n", t); } return 0; }