i = [int(i) for i in input().split()] print(max(sum(i), max(i[:3]) * 3))