#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e3 + 10;
const long long MAXD = 55;
const long long INF = 2e9;
const double eps = 1e-6;
const double PI = acos(-1);
const long long mod = 1e9 + 7;
long long n, d;
long long dp[MAXN * MAXD][MAXD][2];
long long ch[MAXN * MAXD][10], fail[MAXN * MAXD], cnt;
long long val[MAXD][2];
char X[MAXD], Y[MAXD], s[MAXN];
bool ed[MAXN * MAXD];
queue<long long> Q;
template <typename T>
inline bool read(T &a) {
  a = 0;
  char c = getchar();
  long long f = 1;
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    a = a * 10 + (c ^ 48);
    c = getchar();
  }
  return a *= f, true;
}
template <typename A, typename... B>
inline bool read(A &x, B &...y) {
  return read(x) && read(y...);
}
void insert(long long L, long long R) {
  long long now = 0;
  for (long long i = L; i <= R; ++i) {
    long long &to = ch[now][s[i] - '0'];
    if (!to) to = ++cnt;
    now = to;
  }
  ed[now] = true;
}
void modadd(long long &x, long long y) {
  x += y;
  if (x >= mod) x -= mod;
}
void build() {
  long long len = d / 2;
  for (long long i = 1; i + len - 1 <= n; ++i) insert(i, i + len - 1);
  for (long long i = 0; i < 10; ++i)
    if (ch[0][i]) Q.push(ch[0][i]), fail[ch[0][i]] = 0;
  while (Q.size()) {
    long long x = Q.front();
    Q.pop();
    for (long long i = 0; i < 10; ++i) {
      if (ch[x][i]) {
        fail[ch[x][i]] = ch[fail[x]][i];
        Q.push(ch[x][i]);
      } else
        ch[x][i] = ch[fail[x]][i];
    }
  }
}
long long calc(char *c) {
  memset(dp, 0, sizeof dp);
  memset(val, 0, sizeof val);
  dp[0][0][1] = val[d + 1][0] = val[d + 1][1] = 1;
  for (long long i = d, ten = 1; i >= 1; --i) {
    val[i][0] = val[i + 1][0] * 10 % mod;
    val[i][1] = (val[i + 1][1] + ten * (c[i] - '0')) % mod;
    ten = ten * 10 % mod;
  }
  for (long long i = 1; i <= d; ++i) {
    for (long long x = 0; x <= cnt; ++x) {
      if (ed[x]) continue;
      for (long long p = 0; p < 10; ++p) {
        modadd(dp[ch[x][p]][i][0], dp[x][i - 1][0]);
        if (p < c[i] - '0')
          modadd(dp[ch[x][p]][i][0], dp[x][i - 1][1]);
        else if (p == c[i] - '0')
          modadd(dp[ch[x][p]][i][1], dp[x][i - 1][1]);
      }
    }
  }
  long long res = 0;
  for (long long i = 0; i <= cnt; ++i) {
    if (!ed[i]) continue;
    for (long long l = d / 2; l <= d; ++l)
      modadd(res,
             (dp[i][l][0] * val[l + 1][0] + dp[i][l][1] * val[l + 1][1]) % mod);
  }
  return res;
}
signed main() {
  scanf("%s", s + 1);
  scanf("%s", X + 1);
  scanf("%s", Y + 1);
  n = strlen(s + 1), d = strlen(X + 1);
  for (long long i = d; i; --i) {
    if (X[i] == '0')
      X[i] = '9';
    else {
      X[i]--;
      break;
    }
  }
  build();
  printf("%lld\n", (calc(Y) - calc(X) + mod) % mod);
  return 0;
}
