'''****** Задание ******** *Сдача 10. ''' summa = int(input(), 2) number = int(input()) print(f'{number - summa}')