#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; #define FOR(i,a,b) for(ll i=(a);i<(b);++i) #define ALL(v) (v).begin(), (v).end() #define p(s) cout<<(s)<> s; ll hole = 0; for(char c : s){ if(c=='0' || c=='4' || c=='6' || c=='9'){ hole++; } else if(c=='8'){ hole += 2; } } ll answer0 = s.size() * 2 + 1 + hole; ll answer1 = 2 * (hole + 1) + s.size(); ll m = min(answer0, answer1); p(m); return 0; }