l,m,n = map(int, input().split('\n')) a = n%25 b = (n//25 + m)%4 c = ((n//25 + m)//4 + l)%10 print(a+b+c)