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