class Solve: def __init__(self): self.S = [int(i) for i in input().split()] self.a = min(self.S) # >= 0; True self.b = max(self.S)+1 # <= 10**7+1; False def solve(self): S = sorted(self.S) m = S.pop(0) n = m S0, S1 = [s-m for s in S] # S0とS1を同じ数にしようとする d = (S1 - S0)//2 # S0とS1を同じ数又は1個差にできる場合 if S0 >= S1//3: n += (S0 + S1)//4 - int(S0 - d == S1 - 3*d == 2) # 先にS0枯渇 && 残りのS1が5個で1個生成 else: n += S0 + (S1 - 3*S0)//5 return n print(Solve().solve())