#include <bits/stdc++.h>
using namespace std;
int const INF = (int)1e9 + 1e3;
long long const INFL = (long long)1e18 + 1e6;
mt19937 tw(9450189);
uniform_int_distribution<long long> ll_distr;
long long rnd(long long a, long long b) {
  return ll_distr(tw) % (b - a + 1) + a;
}
struct node {
  vector<int> go;
  vector<int> ends;
  int link, parent, dig;
  node(int _parent, int _dig)
      : go(10, -1), link(-1), parent(_parent), dig(_dig) {}
};
vector<node> trie;
int get_go(int, int);
int get_link(int v) {
  if (v == 0 || trie[v].parent == 0) {
    return 0;
  }
  if (trie[v].link != -1) {
    return trie[v].link;
  }
  return trie[v].link = get_go(get_link(trie[v].parent), trie[v].dig);
}
int get_go(int v, int dig) {
  if (trie[v].go[dig] != -1) {
    return trie[v].go[dig];
  }
  if (v == 0) {
    return trie[v].go[dig] = 0;
  }
  return trie[v].go[dig] = get_go(get_link(v), dig);
}
int go_bor(int v, int dig) {
  if (trie[v].go[dig] == -1) {
    trie[v].go[dig] = ((int)trie.size());
    trie.push_back(node(v, dig));
  }
  return trie[v].go[dig];
}
const int MAXN = 2005, SZ = 800 * 2 * 10 + 5;
int d[MAXN][SZ];
void solve() {
  string sl, sr;
  cin >> sl >> sr;
  vector<int> l, r;
  for (char c : sl) {
    l.push_back(c - '0');
  }
  for (char c : sr) {
    r.push_back(c - '0');
  }
  trie.push_back(node(-1, -1));
  int root = 0;
  if (((int)l.size()) != ((int)r.size())) {
    int cur = root;
    for (int i = 0; i < ((int)l.size()); ++i) {
      for (int d = l[i] + 1; d < 10; ++d) {
        int next = go_bor(cur, d);
        trie[next].ends.push_back(((int)l.size()) - i - 1);
      }
      cur = go_bor(cur, l[i]);
    }
    trie[cur].ends.push_back(0);
    cur = root;
    for (int i = 0; i < ((int)r.size()); ++i) {
      int from = 0;
      if (i == 0) {
        from = 1;
      }
      for (int d = from; d < r[i]; ++d) {
        int next = go_bor(cur, d);
        trie[next].ends.push_back(((int)r.size()) - i - 1);
      }
      cur = go_bor(cur, r[i]);
    }
    trie[cur].ends.push_back(0);
    for (int i = ((int)l.size()) + 1; i < ((int)r.size()); ++i) {
      for (int d = 1; d < 10; ++d) {
        int next = go_bor(root, d);
        trie[next].ends.push_back(i - 1);
      }
    }
  } else {
    int cur = root;
    bool flag = false;
    for (int i = 0; i < ((int)l.size()); ++i) {
      if (l[i] == r[i]) {
        cur = go_bor(cur, l[i]);
      } else {
        for (int d = l[i]; d <= r[i]; ++d) {
          if (d == l[i]) {
            int tmp = cur;
            tmp = go_bor(tmp, l[i]);
            for (int j = i + 1; j < ((int)l.size()); ++j) {
              for (int d = l[j] + 1; d < 10; ++d) {
                int next = go_bor(tmp, d);
                trie[next].ends.push_back(((int)l.size()) - j - 1);
              }
              tmp = go_bor(tmp, l[j]);
            }
            trie[tmp].ends.push_back(0);
          } else if (d == r[i]) {
            int tmp = cur;
            tmp = go_bor(tmp, r[i]);
            for (int j = i + 1; j < ((int)r.size()); ++j) {
              for (int d = 0; d < r[j]; ++d) {
                int next = go_bor(tmp, d);
                trie[next].ends.push_back(((int)r.size()) - j - 1);
              }
              tmp = go_bor(tmp, r[j]);
            }
            trie[tmp].ends.push_back(0);
          } else {
            trie[go_bor(cur, d)].ends.push_back(((int)l.size()) - i - 1);
          }
        }
        flag = true;
        break;
      }
    }
    if (flag == false) {
      trie[cur].ends.push_back(0);
    }
  }
  int n;
  cin >> n;
  vector<vector<int>> graph(((int)trie.size()));
  for (int i = 1; i < ((int)trie.size()); ++i) {
    graph[get_link(i)].push_back(i);
  }
  vector<vector<int>> pref(((int)trie.size()), vector<int>(n + 1));
  function<void(int, int)> dfs = [&](int v, int par) {
    for (int e : trie[v].ends) {
      if (e <= n) {
        pref[v][e]++;
      }
    }
    for (int i = 0; i < n; ++i) {
      pref[v][i + 1] += pref[v][i];
    }
    if (par != -1) {
      for (int i = 0; i <= n; ++i) {
        pref[v][i] += pref[par][i];
      }
    }
    for (int to : graph[v]) {
      dfs(to, v);
    }
  };
  dfs(0, -1);
  vector<vector<int>> mem_go(10, vector<int>(((int)trie.size())));
  for (int i = 0; i < ((int)trie.size()); ++i) {
    for (int j = 0; j < 10; ++j) {
      mem_go[j][i] = get_go(i, j);
    }
  }
  memset(d, 128 + 64 + 32, sizeof d);
  d[0][0] = 0;
  for (int i = 0; i < n; ++i) {
    for (int dig = 0; dig < 10; ++dig) {
      for (int j = 0; j < ((int)trie.size()); ++j) {
        int next = mem_go[dig][j];
        int val = d[i][j] + pref[next][n - i - 1];
        d[i + 1][next] = max(d[i + 1][next], val);
      }
    }
  }
  int best = *max_element(d[n], d[n] + ((int)trie.size()));
  vector<vector<int>> is_good(n + 1, vector<int>(((int)trie.size())));
  for (int i = 0; i < ((int)trie.size()); ++i) {
    if (d[n][i] == best) {
      is_good[n][i] = true;
    }
  }
  for (int i = n - 1; i >= 0; --i) {
    for (int j = 0; j < ((int)trie.size()); ++j) {
      for (int dig = 0; dig < 10; ++dig) {
        int next = mem_go[dig][j];
        if (is_good[i + 1][next] &&
            d[i][j] + pref[next][n - i - 1] == d[i + 1][next]) {
          is_good[i][j] = true;
          break;
        }
      }
    }
  }
  cout << best << "\n";
  vector<int> ans;
  int cur = 0;
  for (int i = 0; i < n; ++i) {
    for (int dig = 0; dig < 10; ++dig) {
      int next = mem_go[dig][cur];
      if (is_good[i + 1][next] &&
          d[i][cur] + pref[next][n - i - 1] == d[i + 1][next]) {
        cur = next;
        ans.push_back(dig);
        break;
      }
    }
  }
  for (int num : ans) {
    cout << num;
  }
  cout << "\n";
}
int main() {
  cout << setprecision(15) << fixed;
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int test_count = 1;
  for (int test = 1; test <= test_count; ++test) {
    solve();
  }
}
