#include <bits/stdc++.h>
using namespace std;
inline void proc_status() {
  ifstream t("/proc/self/status");
  cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>())
       << endl;
}
template <typename T>
inline int chkmin(T &a, const T &b) {
  return b < a ? a = b, 1 : 0;
}
template <typename T>
inline int chkmax(T &a, const T &b) {
  return b > a ? a = b, 1 : 0;
}
template <typename T>
inline T sqr(const T &val) {
  return val * val;
}
namespace fastIO {
const int MAX_BUFFER_SIZE = 1 << 16;
char buffer[MAX_BUFFER_SIZE], *cur = buffer, *ed = buffer;
inline char getc() {
  return *(cur == ed ? ed = buffer + fread(buffer, 1, MAX_BUFFER_SIZE, stdin),
           cur = buffer : cur)++;
}
}  // namespace fastIO
using fastIO::getc;
template <typename T>
inline T read() {
  register T sum(0), fg(1);
  register char ch(getc());
  for (; !isdigit(ch); ch = getc())
    if (ch == '-') fg = -1;
  for (; isdigit(ch); ch = getc()) sum = sum * 10 - '0' + ch;
  return sum * fg;
}
const int MOD = (int)1e9 + 7;
inline int fpm(int x, int y) {
  int res = 1;
  for (; y; y >>= 1, x = (long long)x * x % MOD)
    if (y & 1) res = (long long)res * x % MOD;
  return res;
}
inline int inv(int x) {
  assert(x);
  return fpm(x, MOD - 2);
}
const int MAXN = (int)1e3, MAXD = 50;
char s[MAXN + 5], L[MAXD + 5], R[MAXD + 5];
int n, D;
inline void input() {
  auto read_str = [](char *S) {
    register char ch(getc());
    while (!isgraph(ch)) ch = getc();
    for (; isgraph(ch); ch = getc()) *S++ = ch;
    *S = '\0';
    return S;
  };
  n = read_str(s + 1) - s - 1;
  read_str(L + 1);
  D = read_str(R + 1) - R - 1;
}
namespace DFA {
const int MAX_NODE = MAXN * MAXD, alpha = 10;
int trans[MAX_NODE + 5][alpha], fail[MAX_NODE + 5], is_ed[MAX_NODE + 5], cnt;
int rt;
inline int new_node() {
  int u = ++cnt;
  fail[u] = is_ed[u] = 0;
  memset(trans[u], 0, sizeof trans[u]);
  return u;
}
inline void clear() { cnt = 0, rt = new_node(); }
inline void insert(char *st, char *ed) {
  int u = rt;
  for (char *i = st; i != ed; ++i) {
    int &v = trans[u][*i - '0'];
    if (!v) v = new_node();
    u = v;
  }
  is_ed[u] = 1;
}
inline void build_fail() {
  static queue<int> q;
  fail[rt] = 0;
  q.push(rt);
  while (!q.empty()) {
    int u = q.front();
    q.pop(), is_ed[u] |= is_ed[fail[u]];
    for (int i = 0; i < alpha; ++i) {
      int &v = trans[u][i];
      if (!v)
        v = fail[u] ? trans[fail[u]][i] : rt;
      else
        fail[v] = fail[u] ? trans[fail[u]][i] : rt, q.push(v);
    }
  }
}
int f[MAXD + 5][MAX_NODE + 5][2][2];
inline int DP(char *T, int type = 1) {
  memset(f, 0, sizeof f);
  f[0][rt][1][0] = 1;
  for (int i = 0; i < D; ++i)
    for (int u = 1; u <= cnt; ++u)
      for (int j = 0; j < 2; ++j)
        for (int k = 0; k < 2; ++k)
          if (f[i][u][j][k])
            for (int LIM = j ? T[i + 1] - '0' : 9, c = i == 0 ? 1 : 0; c <= LIM;
                 ++c) {
              int v = trans[u][c];
              (f[i + 1][v][j && c == LIM][k | is_ed[v]] += f[i][u][j][k]) %=
                  MOD;
            }
  int ans = 0;
  for (int i = 1; i <= cnt; ++i)
    for (int j = 0; j <= type; ++j) (ans += f[D][i][j][1]) %= MOD;
  return ans;
}
}  // namespace DFA
inline int calc(char *T, int type = 1) {
  DFA::clear();
  for (int i = 1; i + D / 2 - 1 <= n; ++i) DFA::insert(s + i, s + i + D / 2);
  DFA::build_fail();
  return DFA::DP(T, type);
}
inline void solve() {
  int ans = calc(R);
  if (L[1] > '0') (ans -= calc(L, 0)) %= MOD;
  printf("%d\n", (ans + MOD) % MOD);
}
int main() {
  input();
  solve();
  return 0;
}
