m, d = map(int, input().split()) result = 0 if m == 4 and d == 1 else m + d print(result)