a,b = map(int, input().split(" ")) if a > 3: print(a + b * 5) else: print((a + 1) * b - 1)