::x::a,b=io.read("*n","*n")c=a%10 print(c==a%100//10 and c or b//100)goto x