Problem: You are given two integers l and r.

Let's call an integer x modest, if l ≤ x ≤ r.

Find a string of length n, consisting of digits, which has the largest possible number of substrings, which make a modest integer. Substring having leading zeros are not counted. If there are many answers, find lexicographically smallest one.

If some number occurs multiple times as a substring, then in the counting of the number of modest substrings it is counted multiple times as well.

Input

The first line contains one integer l (1 ≤ l ≤ 10^{800}).

The second line contains one integer r (l ≤ r ≤ 10^{800}).

The third line contains one integer n (1 ≤ n ≤ 2 000).

Output

In the first line, print the maximum possible number of modest substrings.

In the second line, print a string of length n having exactly that number of modest substrings.

If there are multiple such strings, print the lexicographically smallest of them.

Examples

Input


1
10
3


Output


3
101


Input


1
11
3


Output


5
111


Input


12345
12346
6


Output


1
012345

Note

In the first example, string «101» has modest substrings «1», «10», «1».

In the second example, string «111» has modest substrings «1» (3 times) and «11» (2 times).

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
struct aho_corasick {
  vector<array<int, 10>> next;
  vector<vector<int>> end_id;
  vector<int> suflink;
  void add_v() {
    next.push_back(array<int, 10>());
    fill(next.back().begin(), next.back().end(), -1);
    suflink.push_back(-1);
    end_id.push_back(vector<int>());
  }
  aho_corasick() { add_v(); }
  void add_string(int id, string s) {
    int v = 0;
    for (char c : s) {
      if (next[v][c - '0'] == -1) {
        add_v();
        next[v][c - '0'] = next.size() - 1;
      }
      v = next[v][c - '0'];
    }
    end_id[v].push_back(id);
  }
  void build() {
    queue<int> q;
    q.push(0);
    while (!q.empty()) {
      int a = q.front();
      q.pop();
      for (int i = 0; i < 10; i++) {
        if (next[a][i] == -1) {
          if (suflink[a] == -1)
            next[a][i] = 0;
          else
            next[a][i] = next[suflink[a]][i];
        } else {
          if (suflink[a] == -1)
            suflink[next[a][i]] = 0;
          else
            suflink[next[a][i]] = next[suflink[a]][i];
          q.push(next[a][i]);
        }
      }
    }
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string l, r;
  int n;
  cin >> l >> r >> n;
  aho_corasick ahc;
  vector<int> wildcard_lengths;
  if (l.size() < r.size()) {
    for (int i = 0; i < (int)(l.size()); i++) {
      for (int q = (l[i] - '0') + (int)(i + 1 != (int)l.size()); q < 10; q++) {
        string w = l.substr(0, i);
        w.push_back('0' + q);
        ahc.add_string(wildcard_lengths.size(), w);
        wildcard_lengths.push_back(l.size() - (i + 1));
      }
    }
    for (int i = (int)(l.size() + 1); i < (int)(r.size()); i++) {
      for (int q = 1; q < 10; q++) {
        string w;
        w.push_back('0' + q);
        ahc.add_string(wildcard_lengths.size(), w);
        wildcard_lengths.push_back(i - 1);
      }
    }
    for (int i = 0; i < (int)(r.size()); i++) {
      for (int q = 0 + (int)(i == 0);
           q < (r[i] - '0') + (int)(i + 1 == (int)r.size()); q++) {
        string w = r.substr(0, i);
        w.push_back('0' + q);
        ahc.add_string(wildcard_lengths.size(), w);
        wildcard_lengths.push_back(r.size() - (i + 1));
      }
    }
  } else if (l == r) {
    ahc.add_string(0, l);
    wildcard_lengths.push_back(0);
  } else if (l.substr(0, l.size() - 1) == r.substr(0, r.size() - 1)) {
    for (int q = l.back(); q <= r.back(); q++) {
      string w = l.substr(0, l.size() - 1);
      w.push_back(q);
      ahc.add_string(wildcard_lengths.size(), w);
      wildcard_lengths.push_back(0);
    }
  } else {
    int lcp = 0;
    while (lcp < (int)l.size() && l[lcp] == r[lcp]) lcp++;
    for (int q = l[lcp] + 1; q < r[lcp]; q++) {
      string w = l.substr(0, lcp);
      w.push_back(q);
      ahc.add_string(wildcard_lengths.size(), w);
      wildcard_lengths.push_back(l.size() - (lcp + 1));
    }
    for (int i = lcp + 1; i < (int)l.size(); i++) {
      for (int q = (l[i] - '0') + (int)(i + 1 != (int)l.size()); q < 10; q++) {
        string w = l.substr(0, i);
        w.push_back('0' + q);
        ahc.add_string(wildcard_lengths.size(), w);
        wildcard_lengths.push_back(l.size() - (i + 1));
      }
      for (int q = 0; q < (r[i] - '0') + (int)(i + 1 == (int)r.size()); q++) {
        string w = r.substr(0, i);
        w.push_back('0' + q);
        ahc.add_string(wildcard_lengths.size(), w);
        wildcard_lengths.push_back(r.size() - (i + 1));
      }
    }
  }
  ahc.build();
  int vs = ahc.next.size();
  vector<vector<int>> wc_not_gr(vs, vector<int>(n));
  vector<bool> vis(vs);
  queue<int> q;
  q.push(0);
  while (!q.empty()) {
    int a = q.front();
    q.pop();
    if (ahc.suflink[a] != -1) {
      for (int i = 0; i < n; i++) {
        wc_not_gr[a][i] = wc_not_gr[ahc.suflink[a]][i];
        for (int id : ahc.end_id[a]) {
          if (wildcard_lengths[id] <= i) {
            wc_not_gr[a][i]++;
          }
        }
      }
    }
    vis[a] = true;
    for (int i = 0; i < 10; i++) {
      if (vis[ahc.next[a][i]]) continue;
      q.push(ahc.next[a][i]);
    }
  }
  vector<vector<int>> dp(n + 1, vector<int>(vs, numeric_limits<int>::min()));
  dp[0][0] = 0;
  for (int i = 0; i < n; i++) {
    for (int v = 0; v < vs; v++) {
      for (int j = 0; j < 10; j++) {
        dp[i + 1][ahc.next[v][j]] =
            max(dp[i + 1][ahc.next[v][j]],
                dp[i][v] + wc_not_gr[ahc.next[v][j]][n - i - 1]);
      }
    }
    for (int v = 0; v < vs; v++) {
    }
  }
  int ans = 0;
  for (int v = 0; v < vs; v++) ans = max(ans, dp[n][v]);
  cout << ans << endl;
  vector<vector<bool>> best_reachable(n + 1, vector<bool>(vs));
  for (int v = 0; v < vs; v++)
    if (dp[n][v] == ans) {
      best_reachable[n][v] = true;
    }
  for (int i = n - 1; i >= 0; i--) {
    for (int v = 0; v < vs; v++) {
      for (int j = 0; j < 10; j++) {
        if (dp[i + 1][ahc.next[v][j]] ==
                dp[i][v] + wc_not_gr[ahc.next[v][j]][n - (i + 1)] &&
            best_reachable[i + 1][ahc.next[v][j]]) {
          best_reachable[i][v] = true;
        }
      }
    }
  }
  assert(best_reachable[0][0]);
  int v = 0;
  string best_ans;
  for (int i = 0; i < n; i++) {
    assert(best_reachable[i][v]);
    for (int j = 0; j < 10; j++) {
      if (best_reachable[i + 1][ahc.next[v][j]] &&
          dp[i + 1][ahc.next[v][j]] ==
              dp[i][v] + wc_not_gr[ahc.next[v][j]][n - (i + 1)]) {
        best_ans.push_back('0' + j);
        v = ahc.next[v][j];
        break;
      }
    }
  }
  cout << best_ans << endl;
  return 0;
}