ls = list(map(int, input().split())) ans = max(sum(ls), max(ls[:3])*3) print(ans)