L = int(input()) M = int(input()) N = int(input()) while N>=25: M += 1 N -= 25 while M>=4: L += 1 M -= 4 while L>=10: L -= 10 print(L+M+N)