from operator import add print(add(*[n // 2 if i == 0 else n % 2 for i, n in enumerate([int(input())] * 2)]))