A = [int(x) for x in input().split()] if sum(A) > max(A[0:3]) * 3: print(sum(A)) else: print(max(A[0:3]) * 3)