#include int main() { char s[11]; int ans=0; scanf("%s",s); for (int i=0;i<9;i++) ans+=(s[i]-'0')%39; printf("%d\n",ans); }