#include #include #include const std::vector num{1, 0, 0, 0, 1, 0, 1, 0, 2, 1}; void solve() { std::string s; std::cin >> s; int x = s.length(); int y = 1; for (char c : s) y += num[c - '0']; std::cout << std::min(x, y) + x + y << std::endl; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }