def calc(V, A, B, C): ret = float('inf') for i in range(V//A+1): for j in range(V//B+1): t = V - A*i - B*j if t < 0: break if t % C == 0: ret = min(ret, i + j + t // C) return ret V = list(map(int, input().split())) ans = float('inf') for A in range(1, 31): for B in range(A + 1, 31): for C in range(B + 1, 31): ans = min(ans, sum(calc(v, A, B, C) for v in V)) print(ans)