#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T &x) {
  x = 0;
  char c = getchar();
  bool flag = false;
  while (!isdigit(c)) {
    if (c == '-') flag = true;
    c = getchar();
  }
  while (isdigit(c)) {
    x = (x << 1) + (x << 3) + (c ^ 48);
    c = getchar();
  }
  if (flag) x = -x;
}
int n, d, tot = 1, las = 1, root = 1, cnt;
int fa[2010], len[2010], ch[2010][12], num[2010];
int f[55][2010][55][2][2];
char s[2010], a[2010], b[2010];
void insert(int c) {
  int p = las, np = las = ++tot;
  len[np] = len[p] + 1;
  while (p && !ch[p][c]) ch[p][c] = np, p = fa[p];
  if (!p)
    fa[np] = root;
  else {
    int q = ch[p][c];
    if (len[q] == len[p] + 1)
      fa[np] = q;
    else {
      int nq = ++tot;
      memcpy(ch[nq], ch[q], sizeof(ch[q]));
      len[nq] = len[p] + 1, fa[nq] = fa[q], fa[np] = fa[q] = nq;
      while (ch[p][c] == q) ch[p][c] = nq, p = fa[p];
    }
  }
}
int dp(int pos, int cur, int lenth, bool lim, bool flag) {
  if (pos == cnt + 1) return flag;
  if (f[pos][cur][lenth][lim][flag] != -1) return f[pos][cur][lenth][lim][flag];
  int v = 0, ma = 9;
  if (lim) ma = num[pos];
  for (int c = 0; c <= ma; ++c) {
    if (pos == 1 && !c) continue;
    if (flag)
      v = (v + dp(pos + 1, cur, lenth, lim && c == ma, 1)) % 1000000007;
    else {
      int p = cur;
      if (ch[p][c])
        v = (v + dp(pos + 1, ch[p][c], lenth + 1, lim && c == ma,
                    lenth + 1 >= d / 2)) %
            1000000007;
      else {
        while (p && !ch[p][c]) p = fa[p];
        if (p)
          v = (v + dp(pos + 1, ch[p][c], len[p] + 1, lim && c == ma,
                      len[p] + 1 >= d / 2)) %
              1000000007;
        else
          v = (v + dp(pos + 1, root, 0, lim && c == ma, 0)) % 1000000007;
      }
    }
  }
  return f[pos][cur][lenth][lim][flag] = v;
}
int solve(char *s) {
  cnt = strlen(s + 1), memset(f, -1, sizeof(f));
  for (int i = 1; i <= cnt; ++i) num[i] = s[i] - '0';
  return dp(1, root, 0, 1, 0);
}
int main() {
  scanf("%s%s%s", s + 1, a + 1, b + 1), n = strlen(s + 1),
                                        d = cnt = strlen(a + 1);
  for (int i = 1; i <= n; ++i) insert(s[i] - '0');
  a[cnt--]--;
  while (a[cnt] - '0' == -1) a[cnt]--, a[cnt--] = 9 + '0';
  printf("%d", (solve(b) - solve(a) + 1000000007) % 1000000007);
  return 0;
}
