#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(i,n) for(int i=0; i=b; --i) #define ALL(c) (c).begin(), (c).end() typedef long long ll; typedef vector VI; typedef vector VL; typedef vector VVI; typedef pair P; typedef pair PL; int main() { int a[] = {1,0,0,0,1,0,1,0,2,1}; string s; cin >> s; int ans = 1, ans2 = 2; REP(i,s.length()){ ans += 2 + a[s[i]-'0']; ans2 += 1 + 2*a[s[i]-'0']; } cout << min(ans, ans2) << endl; return 0; }