#include <bits/stdc++.h>
using namespace std;
const int Max_N(2050);
const int Max_n(805);
const int Max_size(805 * 10 * 2);
int Len, N, L[Max_n], R[Max_n], LCP, Sum[Max_size][Max_n];
void input(int V[Max_n]) {
  char inp[Max_n];
  scanf("%s", inp + 1);
  int len = strlen(inp + 1);
  for (int i = 1; i <= len; ++i) V[len - i + 1] = inp[i] - '0';
  Len = max(Len, len);
}
int size, ch[Max_size][10], Fail[Max_size];
void insertL(int u) {
  for (int i = LCP - 1, c, flag = (LCP <= Len); i >= 1; --i) {
    c = L[i];
    if (flag || c) {
      if (!ch[u][c]) ch[u][c] = ++size;
      u = ch[u][c];
      flag = 1;
    }
    if (i == 1)
      ++Sum[u][0];
    else
      for (c = L[i - 1] + 1; c <= 9; ++c) {
        if (!ch[u][c]) ch[u][c] = ++size;
        ++Sum[ch[u][c]][i - 2];
      }
  }
}
void insertR(int u) {
  for (int i = LCP - 1, c; i >= 1; --i) {
    c = R[i];
    if (!ch[u][c]) ch[u][c] = ++size;
    u = ch[u][c];
    if (i == 1)
      ++Sum[u][0];
    else
      for (c = 0; c <= R[i - 1] - 1; ++c) {
        if (!ch[u][c]) ch[u][c] = ++size;
        ++Sum[ch[u][c]][i - 2];
      }
  }
}
void buildFail() {
  int r, u, v;
  queue<int> Q;
  for (int c = 0; c <= 9; ++c)
    if (u = ch[0][c]) Q.push(u), Fail[u] = 0;
  while (Q.empty() == false) {
    r = Q.front(), Q.pop();
    for (int c = 0; c <= 9; ++c)
      if (u = ch[r][c]) {
        v = Fail[r];
        while (v && !ch[v][c]) v = Fail[v];
        Fail[u] = ch[v][c], Q.push(u);
        for (int i = 0; i <= Len; ++i) Sum[u][i] += Sum[Fail[u]][i];
      } else
        ch[r][c] = ch[Fail[r]][c];
  }
}
void insert() {
  int u = 0;
  for (int i = Len, c; i >= LCP; --i) {
    c = L[i];
    if (!ch[u][c]) ch[u][c] = ++size;
    u = ch[u][c];
  }
  if (LCP == 1) {
    ++Sum[u][0];
    goto loop;
  }
  for (int c = L[LCP - 1] + 1; c <= R[LCP - 1] - 1; ++c) {
    if (!ch[u][c]) ch[u][c] = ++size;
    ++Sum[ch[u][c]][LCP - 2];
  }
  insertL(u), insertR(u);
loop:
  for (int u = 1; u <= size; ++u)
    for (int i = 1; i <= Len; ++i) Sum[u][i] += Sum[u][i - 1];
  buildFail();
}
int F[Max_N][Max_size];
void dp() {
  for (int u = 0; u <= size; ++u) F[N][u] = Sum[u][0];
  for (int i = N - 1; i >= 0; --i)
    for (int u = 0, v; u <= size; ++u) {
      F[i][u] = -0X3F3F3F3F;
      for (int c = 0; c <= 9; ++c)
        F[i][u] = max(F[i][u], F[i + 1][ch[u][c]] + Sum[u][min(N - i, Len)]);
    }
  printf("%d\n", F[0][0]);
  for (int i = 0, u = 0; i <= N - 1; ++i)
    for (int c = 0; c <= 9; ++c)
      if (F[i][u] == F[i + 1][ch[u][c]] + Sum[u][min(N - i, Len)]) {
        printf("%d", c), u = ch[u][c];
        break;
      }
}
int main() {
  input(L), input(R), scanf("%d", &N);
  for (LCP = Len; LCP >= 0; --LCP)
    if (LCP == 0 || L[LCP] != R[LCP]) {
      ++LCP;
      break;
    }
  insert();
  dp();
  return 0;
}
