#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T read() {
  T x = 0, w = 1;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') w = -w;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
  return x * w;
}
template <class T>
inline T read(T& x) {
  return x = read<T>();
}
const int P = 1e9 + 7;
inline int add(int a, int b) { return (a += b) >= P ? a - P : a; }
inline int mul(int a, int b) { return (long long)a * b % P; }
inline int fpow(int a, int b) {
  int ans = 1;
  for (; b; b >>= 1, a = mul(a, a))
    if (b & 1) ans = mul(ans, a);
  return ans;
}
inline void chkadd(int& a, int b) { (a += b) >= P ? a -= P : 0; }
char S[1002], X[52], Y[52];
int ch[25000][10], fa[25000], val[25000], tot;
int F[51][25000][2][2];
int main() {
  scanf("%s", S + 1);
  int n = strlen(S + 1);
  scanf("%s%s", X + 1, Y + 1);
  int d = strlen(X + 1);
  if (n < d / 2) {
    puts("0");
    return 0;
  }
  for (int i = 1; i + d / 2 - 1 <= n; ++i) {
    int x = 0;
    for (int j = i; j <= i + d / 2 - 1; ++j) {
      int c = S[j] - '0';
      if (!ch[x][c]) ch[x][c] = ++tot;
      x = ch[x][c];
    }
    val[x] = 1;
  }
  deque<int> Q;
  for (int c = 0; c <= 9; ++c)
    if (ch[0][c]) Q.push_back(ch[0][c]);
  while (Q.size()) {
    int x = Q.front();
    Q.pop_front();
    for (int c = 0; c <= 9; ++c) {
      if (!ch[x][c])
        ch[x][c] = ch[fa[x]][c];
      else
        fa[ch[x][c]] = ch[fa[x]][c], Q.push_back(ch[x][c]);
    }
  }
  for (int x = 0; x <= tot; ++x)
    if (val[x]) fill(ch[x], ch[x] + 10, x);
  F[0][0][1][1] = 1;
  for (int i = 1; i <= d; ++i)
    for (int x = 0; x <= tot; ++x)
      for (int l = 0; l <= 1; ++l)
        for (int r = 0; r <= 1; ++r) {
          if (!F[i - 1][x][l][r]) continue;
          for (int c = 0; c <= 9; ++c) {
            if (l and c < X[i] - '0') continue;
            if (r and c > Y[i] - '0') continue;
            chkadd(F[i][ch[x][c]][l and c == X[i] - '0'][r and c == Y[i] - '0'],
                   F[i - 1][x][l][r]);
          }
        }
  int ans = 0;
  for (int x = 0; x <= tot; ++x)
    if (val[x])
      for (int l = 0; l <= 1; ++l)
        for (int r = 0; r <= 1; ++r) chkadd(ans, F[d][x][l][r]);
  printf("%d\n", ans);
  return 0;
}
