import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines import itertools *V, = map(int, read().split()) def solve(A, B, C): INF = 100 dp = [INF] * 31 dp[0] = 0 for value in [A, B, C]: for n in range(31 - value): x = dp[n] + 1 if dp[n + value] > x: dp[n + value] = x return sum(dp[v] for v in V) ans = min(solve(A, B, C) for A, B, C in itertools.combinations(range(1, 31), 3)) print(ans)