#include <bits/stdc++.h>
using namespace std;
int get() {
  char ch;
  while (ch = getchar(), (ch < '0' || ch > '9') && ch != '-')
    ;
  if (ch == '-') {
    int s = 0;
    while (ch = getchar(), ch >= '0' && ch <= '9') s = s * 10 + ch - '0';
    return -s;
  }
  int s = ch - '0';
  while (ch = getchar(), ch >= '0' && ch <= '9') s = s * 10 + ch - '0';
  return s;
}
const int N = 3205;
const int INF = 1e9;
int n;
char rig[N], lef[N];
int lenr, lenl;
int f[2005][N];
pair<int, int> lst[2005][N];
int sa[N], y[N];
int rk[N];
int a[N], b[N], cnt[N];
int all[N];
int to[N][10];
int nxt[N];
int main() {
  scanf("%s", lef + 1);
  scanf("%s", rig + 1);
  n = get();
  lenl = strlen(lef + 1);
  lenr = strlen(rig + 1);
  int w = lenl;
  for (; w && lef[lenl] == '0';) lef[w--] = '9';
  lef[w]--;
  if (lef[1] == '0') {
    for (int i = 1; i <= lenl - 1; i++) lef[i] = lef[i + 1];
    lenl--;
  }
  if (lenl == 0) lenl = 1, lef[1] = '0';
  int m = 0;
  for (int i = 1; i <= lenl; i++) all[y[++m] = i] = lef[i] - '0';
  for (int i = 1; i <= lenr; i++) all[y[++m] = i + lenl + lenr] = rig[i] - '0';
  for (int i = lenl + 1; i <= lenl + lenr; i++) all[i] = 10, a[i] = b[i] = INF;
  for (int i = 1; i <= lenr; i++)
    all[i + lenl + lenr * 2] = 10,
                          a[i + lenl + lenr * 2] = b[i + lenl + lenr * 2] = INF;
  for (int i = 1; i <= m; i++) cnt[all[y[i]]]++;
  for (int i = 1; i <= 9; i++) cnt[i] += cnt[i - 1];
  for (int i = 1; i <= m; i++) sa[cnt[all[y[i]]]--] = y[i];
  int k = 1;
  a[sa[1]] = 1;
  for (int i = 2; i <= m; i++) {
    if (all[sa[i]] > all[sa[i - 1]]) k++;
    a[sa[i]] = k;
  }
  for (int j = 1; j <= max(lenl, lenr); j <<= 1) {
    int u = 0;
    for (int i = 1; i <= m; i++)
      if (sa[i] > j && all[sa[i] - j] < 10) y[++u] = sa[i] - j;
    for (int i = 1; i <= m; i++)
      if (all[sa[i] + j] == 10) y[++u] = sa[i];
    for (int i = 0; i <= m; i++) cnt[i] = 0;
    for (int i = 1; i <= m; i++) cnt[a[y[i]]]++;
    for (int i = 1; i <= m; i++) cnt[i] += cnt[i - 1];
    for (int i = m; i >= 1; i--) sa[cnt[a[y[i]]]--] = y[i];
    for (int i = 1; i <= m; i++) b[sa[i]] = a[sa[i]];
    a[sa[1]] = k = 1;
    for (int i = 2; i <= m; i++) {
      if (b[sa[i]] > b[sa[i - 1]] ||
          (b[sa[i]] == b[sa[i - 1]] && b[sa[i] + j] > b[sa[i - 1] + j]))
        k++;
      a[sa[i]] = k;
    }
  }
  int wl, wr;
  for (int i = 1; i <= m; i++) {
    nxt[sa[i]] = sa[i] + 1;
    if (sa[i] == 1) wl = i;
    if (sa[i] == lenl + lenr + 1) wr = i;
    if (sa[i] == lenl) nxt[sa[i]] = 0;
    if (sa[i] == lenl + lenr + lenr) nxt[sa[i]] = 0;
    rk[sa[i]] = i;
  }
  rk[0] = m + 1;
  for (int i = 1; i <= m + 1; i++) {
    int x = sa[i];
    for (int c = 0; c <= 9; c++) {
      int y = m + 1;
      int l = 1, r = m;
      for (; l <= r;) {
        int mid = (l + r) / 2;
        int u = sa[mid];
        if (all[u] > c || (all[u] == c && rk[nxt[u]] >= i))
          y = mid, r = mid - 1;
        else
          l = mid + 1;
      }
      to[i][c] = y;
    }
  }
  for (int i = 0; i <= n + 1; i++)
    for (int j = 1; j <= m + 1; j++) f[i][j] = -INF;
  f[n + 1][m + 1] = 0;
  for (int i = n + 1; i >= 2; i--)
    for (int j = 1; j <= m + 1; j++)
      if (f[i][j] != -INF) {
        for (int c = 0; c <= 9; c++) {
          int p = to[j][c];
          int len = n - i + 2;
          int ad = max(0, min(len + 1, lenr) - lenl - 1);
          if (c != 0) {
            if (lenl == lenr) {
              if (len >= lenl && p > wl && p <= wr) ad = 1;
            } else {
              if (len >= lenl && p > wl) ad++;
              if (len >= lenr && p <= wr) ad++;
            }
          } else
            ad = 0;
          if (f[i][j] + ad > f[i - 1][p] ||
              (f[i][j] + ad == f[i - 1][p] &&
               (c < lst[i - 1][p].first ||
                (c == lst[i - 1][p].first && j < lst[i - 1][p].second)))) {
            f[i - 1][p] = f[i][j] + ad;
            lst[i - 1][p] = make_pair(c, j);
          }
        }
      }
  w = 1;
  for (int i = 2; i <= m + 1; i++)
    if (f[1][w] < f[1][i]) w = i;
  printf("%d\n", f[1][w]);
  int pw = w;
  w = pw;
  for (int i = 1; i <= n; i++) {
    putchar('0' + lst[i][w].first);
    w = lst[i][w].second;
  }
  putchar('\n');
  return 0;
}
