#include <bits/stdc++.h>
using namespace std;
const int maxl = 55, mod = 1000000007, maxn = 1005, maxs = maxn << 1, maxk = 10;
int n, d, last, tot;
int num[maxl], Len[maxs], link[maxs], nxt[maxs][maxk],
    f[maxl][maxs][maxl][2][2];
string s, x, y;
int extend(int last, int x) {
  int pos = last, now = ++tot, tmp, cln;
  Len[now] = Len[pos] + 1;
  while (pos > 0 && nxt[pos][x] == 0) nxt[pos][x] = now, pos = link[pos];
  if (pos == 0) {
    link[now] = 1;
    return now;
  }
  tmp = nxt[pos][x];
  if (Len[tmp] == Len[pos] + 1) {
    link[now] = tmp;
    return now;
  }
  cln = ++tot, Len[cln] = Len[pos] + 1;
  link[cln] = link[tmp], link[now] = link[tmp] = cln;
  for (int i = 0; i <= 9; i++) nxt[cln][i] = nxt[tmp][i];
  while (pos > 0 && nxt[pos][x] == tmp) nxt[pos][x] = cln, pos = link[pos];
  return now;
}
int dfs(int len, int now, int match, int flg, int ok) {
  ok |= (match >= (d / 2));
  if (len == d + 1) return ok;
  if (f[len][now][match][flg][ok] != -1) return f[len][now][match][flg][ok];
  int res = 0;
  for (int i = 0; i <= 9; i++)
    if (flg == 0 || i <= num[len]) {
      int nf = flg && i == num[len], r = 0;
      if (ok == 0) {
        if (nxt[now][i] == 0) {
          int pos = now;
          while (pos > 0 && nxt[pos][i] == 0) pos = link[pos];
          if (pos == 0)
            r = dfs(len + 1, 1, 0, nf, 0);
          else
            r = dfs(len + 1, nxt[pos][i], Len[pos] + 1, nf, 0);
        } else
          r = dfs(len + 1, nxt[now][i], match + 1, nf, 0);
      } else
        r = dfs(len + 1, now, match, nf, 1);
      res = (res + r) % mod;
    }
  return f[len][now][match][flg][ok] = res;
}
int calc(string s) {
  memset(f, -1, sizeof(f));
  for (int i = 1; i <= d; i++) num[i] = s[i] - 48;
  return dfs(1, 1, 0, 1, 0);
}
int main() {
  cin >> s >> x >> y, n = s.size(), d = x.size(), s = " " + s, x = " " + x,
                      y = " " + y;
  last = tot = 1;
  for (int i = 1; i <= n; i++) last = extend(last, s[i] - 48);
  for (int i = d; i >= 1; i--) {
    if (x[i] != '0') {
      x[i]--;
      break;
    } else
      x[i] = '9';
  }
  printf("%d\n", (calc(y) - calc(x) + mod) % mod);
  return 0;
}
