0
/*
@ Author :GaominQuan
@ Data :2014-2-21
@ Mail :[email protected]
*/
#include
#include
using namespace std;
int getPA(int a,int dA){
int num = 0, pA = 0;
while(a>0){
int tail = a%10;
if( tail == dA){
pA += dA*pow(10,num);
num++;
}
a = a/10;
}
return pA;
}
int main(){
int A = 0, DA = 0,B = 0, DB = 0;
cin>>A>>DA>>B>>DB;
cout<<(getPA(A,DA)+getPA(B,DB));
return 0;
}