#include <bits/stdc++.h>
using namespace std;
struct node {
  int cnt, nxt[10], fail;
} a[1000005];
int tcnt;
char s[1005], sa[1005], sb[1005];
void Insert(int l, int r) {
  int p = 0;
  for (int i = l; i <= r; i++) {
    int c = s[i] - '0';
    if (!a[p].nxt[c]) a[p].nxt[c] = ++tcnt;
    p = a[p].nxt[c];
  }
  a[p].cnt = 1;
}
void Build() {
  queue<int> Q;
  for (int i = 0; i < 10; i++)
    if (a[0].nxt[i]) Q.push(a[0].nxt[i]);
  while (!Q.empty()) {
    int p = Q.front();
    Q.pop();
    for (int i = 0; i < 10; i++) {
      int &q = a[p].nxt[i], r = a[p].fail;
      if (q) {
        a[q].fail = a[r].nxt[i];
        a[q].cnt |= a[a[q].fail].cnt;
        Q.push(q);
      } else
        q = a[r].nxt[i];
    }
  }
}
bool Match(char *s) {
  int n = strlen(s);
  int p = 0;
  for (int i = 0; i < n; i++) {
    p = a[p].nxt[s[i] - '0'];
    if (a[p].cnt) return true;
  }
  return false;
}
int dp[2][1000005][2][2], f[1005];
int DP(char *s) {
  int n = strlen(s);
  for (int i = 0; i < n; i++) f[i + 1] = s[i] - '0';
  memset(dp, 0, sizeof(dp));
  dp[0][0][1][0] = 1;
  for (int i = 0; i < n; i++) {
    int u = i & 1, v = u ^ 1;
    memset(dp[v], 0, sizeof(dp[v]));
    for (int j = 0; j <= tcnt; j++)
      for (int k = 0; k < 2; k++)
        for (int l = 0; l < 2; l++)
          if (dp[u][j][k][l]) {
            int t = k ? f[i + 1] : 9;
            for (int m = 0; m <= t; m++) {
              int nj = a[j].nxt[m], nk = k && (m == t), nl = l || (a[nj].cnt);
              dp[v][nj][nk][nl] =
                  (dp[v][nj][nk][nl] + dp[u][j][k][l]) % 1000000007;
            }
          }
  }
  int ans = 0;
  for (int j = 0; j <= tcnt; j++)
    for (int k = 0; k < 2; k++) ans = (ans + dp[n & 1][j][k][1]) % 1000000007;
  return ans;
}
int main() {
  scanf("%s", s);
  scanf("%s", sa);
  scanf("%s", sb);
  int n = strlen(s), m = strlen(sa);
  for (int j = 0; j + m / 2 - 1 < n; j++) Insert(j, j + m / 2 - 1);
  Build();
  int ans1 = DP(sa);
  if (Match(sa)) ans1--;
  int ans2 = DP(sb);
  int ans = (ans2 - ans1 + 1000000007) % 1000000007;
  printf("%d\n", ans);
}
