#include <bits/stdc++.h>
using namespace std;
const int maxn = 30033;
const long long mod = 1000000007;
int trans[maxn][10], fail[maxn], cur = 0;
long long DP[2][maxn][2];
int E[maxn], tot = 0;
char C[1111];
char A[55], B[55];
int n;
void build_trie() {
  int m = strlen(C + 1), l = n / 2;
  for (int i = 1; i + l - 1 <= m; i++) {
    int p = 0;
    for (int j = i; j <= i + l - 1; j++) {
      int k = C[j] - '0';
      if (!trans[p][k]) trans[p][k] = ++cur;
      p = trans[p][k];
    }
    E[++tot] = p;
  }
}
int q[maxn];
int head, tail;
void AC_build() {
  head = tail = 0;
  for (int i = 0; i < 10; i++)
    if (trans[0][i]) q[tail++] = trans[0][i];
  while (head < tail) {
    int u = q[head++];
    for (int i = 0; i < 10; i++) {
      if (trans[u][i]) {
        int son = trans[u][i], p = fail[u];
        while (p && !trans[p][i]) p = fail[p];
        fail[son] = trans[p][i];
        q[tail++] = son;
      }
    }
  }
}
int tt;
long long GetDP(char* c) {
  memset(DP, 0, sizeof(DP));
  int pp = 0;
  tt = 0;
  int now = 0, last = 1;
  for (int i = 1; i <= n; i++) {
    swap(now, last);
    memset(DP[now], 0, sizeof(DP[now]));
    for (int j = 0; j <= cur; j++) {
      for (int k = 0; k < 10; k++) {
        int p = j;
        while (!trans[p][k] && p) p = fail[p];
        p = trans[p][k];
        DP[now][p][0] += DP[last][j][0];
        if (DP[now][p][0] >= mod) DP[now][p][0] -= mod;
        DP[now][p][1] += DP[last][j][1];
        if (DP[now][p][1] >= mod) DP[now][p][1] -= mod;
      }
    }
    for (int k = 0; k < c[i] - '0'; k++) {
      int p = pp;
      while (!trans[p][k] && p) p = fail[p];
      p = trans[p][k];
      DP[now][p][tt]++;
      if (DP[now][p][tt] >= mod) DP[now][p][tt] -= mod;
    }
    int k = c[i] - '0';
    while (!trans[pp][k] && pp) pp = fail[pp];
    pp = trans[pp][k];
    for (int j = 1; j <= tot; j++) {
      DP[now][E[j]][1] += DP[now][E[j]][0];
      DP[now][E[j]][0] = 0;
      if (DP[now][E[j]][1] >= mod) DP[now][E[j]][1] -= mod;
      if (E[j] == pp) tt = 1;
    }
  }
  long long ret = tt;
  for (int i = 0; i <= cur; i++) {
    ret += DP[now][i][1];
    if (ret >= mod) ret -= mod;
  }
  return ret;
}
int main() {
  scanf("%s", C + 1);
  scanf("%s", A + 1);
  scanf("%s", B + 1);
  n = strlen(A + 1);
  build_trie();
  AC_build();
  long long ans = GetDP(B) - GetDP(A);
  ans += tt;
  if (ans < 0) ans += mod;
  cout << ans << endl;
  return 0;
}
