#include <bits/stdc++.h>
using namespace std;
const int N = 50005;
int ch[N][10], ed[N], fail[N], tot = 0;
char s[N];
void insert(int l, int r) {
  int now = 0;
  for (int i = l; i <= r; i++) {
    if (!ch[now][s[i] - '0']) ch[now][s[i] - '0'] = ++tot;
    now = ch[now][s[i] - '0'];
  }
  ed[now] = true;
}
void build() {
  queue<int> Q;
  for (int i = 0; i <= 9; i++)
    if (ch[0][i]) Q.push(ch[0][i]);
  while (!Q.empty()) {
    int x = Q.front();
    Q.pop();
    ed[x] |= ed[fail[x]];
    for (int i = 0; i <= 9; 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];
  }
}
const int Mod = 1e9 + 7;
int dp[55][N][2], f[N][2], n, d, l;
void add(int& x, int y) { x = (x + y < Mod ? x + y : x + y - Mod); }
int solve(char* t) {
  memset(f, 0, sizeof(f));
  f[d + 1][0] = f[d + 1][1] = 1;
  for (int i = d; i >= 1; i--)
    f[i][0] = 1ll * f[i + 1][0] * 10 % Mod,
    f[i][1] = (1ll * (t[i] - '0') * f[i + 1][0] + f[i + 1][1]) % Mod;
  memset(dp, 0, sizeof(dp));
  dp[0][0][1] = 1;
  for (int i = 0; i < d; i++)
    for (int j = 0; j <= tot; j++)
      if (!ed[j])
        for (int k = 0; k <= 9; k++) {
          add(dp[i + 1][ch[j][k]][0], dp[i][j][0]);
          if (k == t[i + 1] - '0')
            add(dp[i + 1][ch[j][k]][1], dp[i][j][1]);
          else if (k < t[i + 1] - '0')
            add(dp[i + 1][ch[j][k]][0], dp[i][j][1]);
        }
  int ans = 0;
  for (int i = 1; i <= d; i++)
    for (int j = 1; j <= tot; j++)
      if (ed[j])
        add(ans, (1ll * dp[i][j][0] * f[i + 1][0] +
                  1ll * dp[i][j][1] * f[i + 1][1]) %
                     Mod);
  return ans;
}
char x[N], y[N];
int main() {
  scanf("%s", s + 1);
  scanf("%s", x + 1);
  scanf("%s", y + 1);
  n = strlen(s + 1), d = strlen(x + 1), l = d / 2;
  for (int i = 1; i <= n - l + 1; i++) insert(i, i + l - 1);
  build();
  for (int i = d; i >= 1; i--)
    if (x[i] != '0') {
      x[i]--;
      for (int j = i + 1; j <= d; j++) x[j] = '9';
      break;
    }
  printf("%d", (solve(y) - solve(x) + Mod) % Mod);
  return 0;
}
