#include #define REP(i, a, n) for(int i = (a); i < (n); i++) using namespace std; long table[10] = { 1, 0, 0, 0, 1, 0, 1, 0, 2, 1 }; int main(void) { string s; cin >> s; long ans = s.length() * 2 + 1; REP(i, 0, s.length()) { ans += table[s[i] - '0']; } cout << ans << endl; return 0; }