#include <bits/stdc++.h>
using namespace std;
const int maxn = 2005;
char L[maxn], R[maxn];
int n, rt = 1, tot = 1, ch[maxn][10], fail[maxn];
int f[maxn][maxn], g[maxn][maxn][10];
void insert(char *s, int len, int v) {
  int nw = rt;
  for (int i = 1; i <= len; i++) {
    int nxt = s[i] - '0';
    if (!ch[nw][nxt]) ch[nw][nxt] = ++tot;
    for (int j = (nw == rt); j < nxt; j++) g[nw][len - i + 1][j] += v;
    if (i == len) g[nw][1][nxt] += v;
    nw = ch[nw][nxt];
  }
}
queue<int> Q;
void getfail() {
  for (int i = 0; i < 10; i++) {
    if (ch[rt][i]) {
      fail[ch[rt][i]] = rt;
      Q.push(ch[rt][i]);
    } else
      ch[rt][i] = rt;
  }
  while (!Q.empty()) {
    int u = Q.front();
    Q.pop();
    for (int i = 0; i < 10; i++) {
      if (ch[u][i]) {
        fail[ch[u][i]] = ch[fail[u]][i];
        Q.push(ch[u][i]);
      } else
        ch[u][i] = ch[fail[u]][i];
    }
  }
}
int main() {
  scanf("%s", L + 1);
  int lenl = strlen(L + 1), nw = lenl;
  while (L[nw] == '0') L[nw] = '9', nw--;
  L[nw]--;
  if (L[1] == '0') {
    lenl--;
    for (int i = 1; i <= lenl; i++) L[i] = L[i + 1];
  }
  if (lenl) insert(L, lenl, -1);
  scanf("%s", R + 1);
  int lenr = strlen(R + 1);
  insert(R, lenr, 1);
  getfail();
  scanf("%d", &n);
  for (int i = 2; i <= tot; i++)
    for (int j = 1; j <= n; j++)
      for (int k = 0; k < 10; k++) g[i][j][k] += g[fail[i]][j][k];
  for (int i = 1; i <= tot; i++)
    for (int j = max(lenl, 1); j < lenr; j++)
      for (int k = 1; k < 10; k++) g[i][j][k]++;
  for (int i = 1; i <= tot; i++)
    for (int j = 1; j <= n; j++)
      for (int k = 0; k < 10; k++) g[i][j][k] += g[i][j - 1][k];
  for (int i = n - 1; i >= 0; i--)
    for (int j = 1; j <= tot; j++) {
      f[i][j] = -0x3f3f3f3f;
      for (int k = 0; k < 10; k++)
        f[i][j] = max(f[i][j], f[i + 1][ch[j][k]] + g[j][n - i][k]);
    }
  printf("%d\n", f[0][rt]);
  nw = rt;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < 10; j++)
      if (f[i][nw] == f[i + 1][ch[nw][j]] + g[nw][n - i][j]) {
        printf("%d", j);
        nw = ch[nw][j];
        break;
      }
  return 0;
}
