M, N = map(int, input().split())

if N % 3 == 0:
    print(M+N//3)
else:
    print(M+N/3)