import strutils, sequtils var AB = stdin.readLine.split for i, v in AB: AB[i] = align(v, AB.mapIt(it.len).max, '0') for i in 0 ..< AB[0].len: var j = 0 if AB[0][i] == '4' or AB[0][i] == '7': if AB[1][i] == '4' or AB[1][i] == '7': j = 1 case AB[0][i].int - AB[1][i].int of 0: continue of 1 .. int.high: echo AB[j].parseInt else: echo AB[j xor 1].parseInt quit()