n, m = map(int, input().split()) if n == 3 and m == 0: print(5) else: print(4)