print((function (f, s) return f(s) end)(function (s) function f(n) local isF,isB = n%3==0,n%5==0 return (isF and isB) and 8 or (isF or isB) and 4 or #tostring(n) end local r = 0 for e in s:gmatch("%d+") do r=r+f(tonumber(e)) end return r end, io.stdin:read("*l")))