#include using namespace std; signed main(){ string n; cin >> n; int v[10] = {4, 3, 3, 3, 4, 3, 4, 3, 5, 4}; for(int i = 0; i < 10; i++)v[i] -= 3; long long count = 0; for(int i = 0; i < n.length(); i++){ int a = n[i] - '0'; count += v[a]; } count = min(n.length() * 2 + count + 1, 2 * (count + 1) + n.length()); cout << count << endl; }