#include using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { cin.tie(nullptr)->sync_with_stdio(false); string p, n; cin >> p >> n; if (n.size() >= 2) n = "10"; rep(_, stoi(n)) { ll nxt = 0; for (char c : p) { if (c == '-') nxt += 1; if (c == '0') nxt += 6; if (c == '1') nxt += 2; if (c == '2') nxt += 5; if (c == '3') nxt += 5; if (c == '4') nxt += 4; if (c == '5') nxt += 5; if (c == '6') nxt += 6; if (c == '7') nxt += 4; if (c == '8') nxt += 7; if (c == '9') nxt += 6; } p = to_string(nxt); } cout << p << '\n'; return 0; }