#include <bits/stdc++.h>
const int N = 2000;
const int L = 800;
const int M = 11 + 2 * (L + 1) * 10;
int n, len, m, low[L + 1], high[L + 1], fail[M], go[M][10], count[N + 1][M],
    dp[N + 1][M];
bool mark[N + 1][M];
std::vector<std::pair<int, int>> candidates;
int read_bigint(int *out) {
  static char buf[L + 2];
  scanf("%s", buf);
  int len = strlen(buf);
  for (int i = 0; i < len; ++i) {
    out[i] = buf[i] - '0';
  }
  return len;
}
void update(int &x, int a) { x = std::max(x, a); }
void gen(int i, bool has_started, bool is_greater, bool is_less, int u) {
  if (i == len || (is_greater && is_less)) {
    count[len - i][u]++;
  } else {
    for (int d = is_greater ? 0 : low[i]; d <= (is_less ? 9 : high[i]); ++d) {
      int uu = u;
      bool hs = has_started || d != 0;
      if (hs) {
        if (go[u][d] == -1) {
          go[u][d] = m++;
        }
        uu = go[u][d];
      }
      gen(i + 1, hs, is_greater || low[i] < d, is_less || d < high[i], uu);
    }
  }
}
int main() {
  int lenl = read_bigint(low);
  len = read_bigint(high);
  scanf("%d", &n);
  std::move_backward(low, low + lenl, low + len);
  std::fill(low, low + (len - lenl), 0);
  memset(go, -1, sizeof(go));
  m++;
  gen(0, false, false, false, 0);
  {
    std::vector<int> queue;
    for (int d = 0; d < 10; ++d) {
      int &v = go[0][d];
      if (~v) {
        fail[v] = 0;
        queue.push_back(v);
      } else {
        v = 0;
      }
    }
    for (int head = 0; head < (int)queue.size(); ++head) {
      int u = queue[head];
      for (int d = 0; d < 10; ++d) {
        int &v = go[u][d];
        if (~v) {
          fail[v] = go[fail[u]][d];
          queue.push_back(v);
        } else {
          v = go[fail[u]][d];
        }
      }
    }
    for (int j = 0; j <= n; ++j) {
      for (auto &&u : queue) {
        count[j][u] += count[j][fail[u]];
      }
    }
    for (int j = 1; j <= n; ++j) {
      for (int u = 0; u < m; ++u) {
        count[j][u] += count[j - 1][u];
      }
    }
  }
  for (int i = 0; i < m; ++i) {
    candidates.emplace_back(i, go[i][0]);
    for (int d = 1; d < 10; ++d) {
      if (go[i][d] != candidates.back().second) {
        candidates.emplace_back(i, go[i][d]);
      }
    }
  }
  memset(dp, -1, sizeof(dp));
  dp[0][0] = 0;
  for (int i = 0; i < n; ++i) {
    const int *cnt = count[n - i - 1];
    for (auto &&iterator : candidates) {
      int u = iterator.first;
      int v = iterator.second;
      if (~dp[i][u]) {
        update(dp[i + 1][v], dp[i][u] + cnt[v]);
      }
    }
  }
  int result = *std::max_element(dp[n], dp[n] + m);
  printf("%d\n", result);
  for (int j = 0; j < m; ++j) {
    mark[n][j] = dp[n][j] == result;
  }
  for (int i = n - 1; i >= 0; --i) {
    const int *cnt = count[n - i - 1];
    for (auto &&iterator : candidates) {
      int u = iterator.first;
      int v = iterator.second;
      mark[i][u] |=
          ~dp[i][u] && dp[i][u] + cnt[v] == dp[i + 1][v] && mark[i + 1][v];
    }
  }
  for (int i = 0, u = 0; i < n; ++i) {
    for (int d = 0; d < 10; ++d) {
      int v = go[u][d];
      if (dp[i][u] + count[n - i - 1][v] == dp[i + 1][v] && mark[i + 1][v]) {
        printf("%d", d);
        u = v;
        break;
      }
    }
  }
  puts("");
}
