A = list(map(int, input().split())) print(max(A[-2] * 3, sum(A)))