#include <bits/stdc++.h>
using namespace std;
const int N = 2e3 + 50;
const int M = 55;
const int Mod = 1e9 + 7;
int add(int a, int b) { return a + b >= Mod ? a + b - Mod : a + b; }
int dec(int a, int b) { return a - b < 0 ? a - b + Mod : a - b; }
void Add(int &a, int b) { a = add(a, b); }
void Dec(int &a, int b) { a = dec(a, b); }
int n, d, a[M];
char S[N];
namespace SAM {
int ch[N][10], len[N], lk[N], nd = 1, las = 1;
void extend(int c) {
  int now = ++nd, p = las;
  len[now] = len[p] + 1;
  las = now;
  for (; p && !ch[p][c]; p = lk[p]) ch[p][c] = now;
  if (!p) {
    lk[now] = 1;
    return;
  }
  int q = ch[p][c];
  if (len[q] == len[p] + 1) {
    lk[now] = q;
    return;
  }
  int cl = ++nd;
  len[cl] = len[p] + 1;
  lk[cl] = lk[q];
  lk[q] = lk[now] = cl;
  memcpy(ch[cl], ch[q], sizeof(ch[q]));
  for (; p && ch[p][c] == q; p = lk[p]) ch[p][c] = cl;
}
int trs[N][10];
void pre_work() {
  static int bin[N], A[N];
  for (int i = 1; i <= nd; i++) bin[len[i]]++;
  for (int i = 1; i <= n; i++) bin[i] += bin[i - 1];
  for (int i = nd; i >= 1; i--) A[bin[len[i]]--] = i;
  for (int i = 1; i <= nd; i++)
    for (int c = 0; c < 10; c++) {
      int x = trs[lk[A[i]]][c];
      if (!ch[A[i]][c])
        trs[A[i]][c] = x;
      else
        trs[A[i]][c] = A[i];
    }
}
void trans(int &x, int &l, int c) {
  if (ch[x][c]) {
    ++l;
    x = ch[x][c];
    return;
  }
  x = trs[x][c];
  if (!x)
    x = 1, l = 0;
  else
    l = len[x] + 1, x = ch[x][c];
}
}  // namespace SAM
int dp[M][N][M][2];
int dfs(int u, int nd, int len, bool hv, bool lim) {
  if (!u) return hv;
  if (!lim && dp[u][nd][len][hv] != -1) return dp[u][nd][len][hv];
  int up = lim ? a[u] : 9, as = 0, rd = nd, rl = len;
  for (int i = u == d ? 1 : 0; i <= up; i++) {
    SAM::trans(nd, len, i);
    Add(as, dfs(u - 1, nd, len, hv | (len >= d / 2), lim && (i == up)));
    nd = rd;
    len = rl;
  }
  if (!lim) dp[u][nd][len][hv] = as;
  return as;
}
int work(char *S, int dlt) {
  int len = d;
  for (int i = 1; i <= len; i++) a[i] = S[len - i + 1] - '0';
  if (dlt) {
    --a[1];
    for (int i = 1; a[i] == 0 && i < d; i++) a[i] = 9, --a[i + 1];
    if (a[d] == 0) return 0;
  }
  memset(dp, -1, sizeof(dp));
  return dfs(len, 1, 0, 0, 1);
}
int main() {
  scanf("%s", S + 1);
  n = strlen(S + 1);
  for (int i = 1; i <= n; i++) SAM::extend(S[i] - '0');
  SAM::pre_work();
  scanf("%s", S + 1);
  d = strlen(S + 1);
  int as = 0;
  Dec(as, work(S, 1));
  scanf("%s", S + 1);
  d = strlen(S + 1);
  Add(as, work(S, 0));
  cout << as;
  return 0;
}
