#include <bits/stdc++.h>
using namespace std;
const int MAXN = 50005;
const int MAXD = 55;
const int MOD = 1e9 + 7;
template <typename T>
inline void read(T &AKNOI) {
  T x = 0, flag = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') flag = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  AKNOI = flag * x;
}
namespace ModCalculator {
inline void Inc(int &x, int y) {
  x += y;
  if (x >= MOD) x -= MOD;
}
inline void Dec(int &x, int y) {
  x -= y;
  if (x < 0) x += MOD;
}
inline int Add(int x, int y) {
  Inc(x, y);
  return x;
}
inline int Sub(int x, int y) {
  Dec(x, y);
  return x;
}
inline int Mul(int x, int y) { return 1LL * x * y % MOD; }
}  // namespace ModCalculator
using namespace ModCalculator;
char s[MAXN], sx[MAXD], sy[MAXD];
int n, d, dg[MAXD];
int tot, ch[MAXN][10], fail[MAXN], ed[MAXN], q[MAXN];
int dp[MAXD][MAXN];
void Insert(int l, int r) {
  int p = 0;
  for (int i = l; i <= r; ++i) {
    int x = s[i] - '0';
    if (!ch[p][x]) ch[p][x] = ++tot;
    p = ch[p][x];
  }
  ed[p] = 1;
}
void GetFail() {
  int head = 1, tail = 0;
  for (int i = 0; i < 10; ++i) {
    if (ch[0][i]) {
      q[++tail] = ch[0][i];
    }
  }
  while (head <= tail) {
    int u = q[head++];
    for (int i = 0; i < 10; ++i) {
      if (ch[u][i]) {
        fail[ch[u][i]] = ch[fail[u]][i];
        q[++tail] = ch[u][i];
      } else {
        ch[u][i] = ch[fail[u]][i];
      }
    }
  }
}
int DP(int i, int j, bool full) {
  if (i > d) return 1;
  if (!full && dp[i][j] != -1) return dp[i][j];
  int ret = 0, r = (full ? dg[i] : 9);
  for (int k = 0; k <= r; ++k) {
    if (ed[ch[j][k]]) continue;
    Inc(ret, DP(i + 1, ch[j][k], full && (k == r)));
  }
  if (!full) dp[i][j] = ret;
  return ret;
}
int Calc(char *ss) {
  int ret = 0;
  for (int i = 1; i <= d; ++i) {
    ret = Add(Mul(ret, 10), (dg[i] = ss[i] - '0'));
  }
  return Sub(ret, DP(1, 0, 1));
}
void init() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  scanf("%s", sx + 1);
  scanf("%s", sy + 1);
  d = strlen(sx + 1);
  int d2 = d / 2;
  for (int i = 1; i + d2 - 1 <= n; ++i) {
    Insert(i, i + d2 - 1);
  }
  GetFail();
}
void solve() {
  int p = d;
  for (; sx[p] == '0'; sx[p--] = '9')
    ;
  sx[p] -= 1;
  memset(dp, -1, sizeof(dp));
  printf("%d\n", Sub(Calc(sy), Calc(sx)));
}
int main() {
  init();
  solve();
  return 0;
}
