#include <bits/stdc++.h>
using namespace std;
const int maxl = 1000 + 10, maxd = 50 + 3;
const long long MOD = 1e9 + 7, oo = 1ll << 62;
long long f[maxd][maxl * maxd][2][2][2];
bool vis[maxd][maxl * maxd][2][2][2];
int x[maxd], y[maxd], fail[maxl * maxd];
int chr[maxl * maxd][10], trisze = 1, d;
bool iend[maxl * maxd];
char s[maxl], t[maxl];
template <class T>
void upsum(T &a, T b) {
  a = (a + b) % MOD;
}
template <class T>
void upmax(T &a, T b) {
  a = max(a, b);
}
void InsertStr(char *s, int len);
void BuildAC();
long long DP(int i, int v, int b1, int b2, int b);
void printAC() {
  for (int sta = 0; sta < trisze; sta++) {
    printf("State %d:fail[%d] = %d ,iend[%d] = %d\n", sta, sta, fail[sta], sta,
           iend[sta]);
    for (int i = 0; i < 10; i++)
      if (chr[sta][i]) printf("\tby  %c  to %d\n", i + '0', chr[sta][i]);
  }
}
int main() {
  scanf("%s", s);
  int ls = strlen(s);
  scanf("%s", t);
  d = strlen(t);
  for (int i = 0; i + d / 2 <= ls; i++) InsertStr(s + i, d / 2);
  BuildAC();
  for (int i = 0; i < d; i++) x[i] = t[i] - '0';
  scanf("%s", t);
  for (int i = 0; i < d; i++) y[i] = t[i] - '0';
  long long ans = DP(0, 0, 1, 1, 0);
  printf("%I64d\n", ans);
  return 0;
}
void InsertStr(char *s, int len) {
  int stat = 0;
  for (int i = 0, cc; i < len; i++) {
    cc = s[i] - '0';
    if (chr[stat][cc] == 0) chr[stat][cc] = trisze++;
    stat = chr[stat][cc];
  }
  iend[stat] = true;
}
void BuildAC() {
  queue<int> Q;
  for (int i = 0; i < 10; i++)
    if (chr[0][i]) Q.push(chr[0][i]);
  while (Q.size()) {
    int u = Q.front();
    Q.pop();
    for (int i = 0; i < 10; i++) {
      int v = chr[u][i], j = fail[u];
      if (v == 0) {
        chr[u][i] = chr[fail[u]][i];
        continue;
      }
      while (j && !chr[j][i]) j = fail[j];
      if (chr[j][i]) j = chr[j][i];
      fail[v] = j;
      Q.push(v);
    }
  }
}
long long DP(int i, int v, int b1, int b2, int b) {
  if (i >= d) return b;
  if (vis[i][v][b1][b2][b]) return f[i][v][b1][b2][b];
  vis[i][v][b1][b2][b] = true;
  long long &o = f[i][v][b1][b2][b];
  for (int j = b1 ? x[i] : 0, vv, bb1, bb2, bb; j <= (b2 ? y[i] : 9); j++) {
    vv = chr[v][j];
    bb1 = b1 & (j <= x[i]);
    bb2 = b2 & (j >= y[i]);
    bb = b | iend[vv];
    upsum(o, DP(i + 1, vv, bb1, bb2, bb));
  }
  return o;
}
