#include <bits/stdc++.h>
using namespace std;
const int N = 1010, M = 55, L = 25025, P = 1000000007, D = 10;
int i, j, k, len, n, m, Tn, ans;
int fx[M][L], fy[M][L], tm[M];
char s[N], x[M], y[M];
struct trie {
  trie *s[D], *f;
  int fg;
} * root, *d[L], T[L];
trie *T_new() {
  trie *t = T + (++Tn);
  for (int i = 0; i < D; i++) t->s[i] = T;
  t->f = T;
  t->fg = 0;
  return t;
}
int F(char *x, int f[M][L], int l, trie *t, int fg1, int fg2) {
  if (t->fg) fg2 = 1;
  if (l > len) {
    if (fg2) return 1;
    return 0;
  }
  if (fg1 && fg2) return tm[len - l + 1];
  if (fg1 && f[l][t - T] != -1) return f[l][t - T];
  int ans = 0;
  if (fg1) {
    for (int i = 0; i < D; i++)
      ans = (ans + F(x, f, l + 1, t->s[i], fg1, fg2)) % P;
  } else {
    for (int i = 0; i < x[l] - '0'; i++)
      ans = (ans + F(x, f, l + 1, t->s[i], 1, fg2)) % P;
    ans = (ans + F(x, f, l + 1, t->s[x[l] - '0'], 0, fg2)) % P;
  }
  if (fg1) f[l][t - T] = ans;
  return ans;
}
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  scanf("%s", x + 1);
  len = strlen(x + 1);
  scanf("%s", y + 1);
  root = T_new();
  m = len / 2;
  tm[0] = 1;
  for (i = 1; i <= len; i++) tm[i] = 10ll * tm[i - 1] % P;
  for (i = 1; i + m - 1 <= n; i++) {
    trie *t = root;
    for (j = i; j <= i + m - 1; j++) {
      if (t->s[s[j] - '0'] == T) t->s[s[j] - '0'] = T_new();
      t = t->s[s[j] - '0'];
    }
    t->fg = 1;
  }
  j = 0;
  for (i = 0; i < D; i++) {
    if (root->s[i] != T)
      d[++j] = root->s[i], d[j]->f = root;
    else
      root->s[i] = root;
  }
  i = 0;
  while (i < j) {
    i++;
    for (k = 0; k < D; k++) {
      if (d[i]->s[k] != T)
        d[++j] = d[i]->s[k], d[j]->f = d[i]->f->s[k];
      else
        d[i]->s[k] = d[i]->f->s[k];
    }
  }
  trie *t = root;
  for (i = 1; i <= len; i++) {
    t = t->s[x[i] - '0'];
    if (t->fg) {
      ans = 1;
      break;
    }
  }
  memset(fx, -1, sizeof fx);
  memset(fy, -1, sizeof fy);
  ans = (F(y, fy, 1, root, 0, 0) + P - F(x, fx, 1, root, 0, 0) + ans) % P;
  printf("%d\n", ans);
}
