l = int(input()) m = int(input()) n = int(input()) p = int(l/40) l -= 40*p m += p q = int(m/4) m -= 4*q n += q r = int(n/10) n -= 10*r print(l + m + n)