#include <bits/stdc++.h>
using namespace std;
inline int read() {
  register int x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 3) + (x << 1) + ch - '0';
    ch = getchar();
  }
  return (f == 1) ? x : -x;
}
inline int getd() {
  int x = getchar();
  while (!isdigit(x)) x = getchar();
  return x - '0';
}
int n, D, X[101], Y[101];
char S[1010], X_[101], Y_[101];
struct Suffix_Automaton {
  int len[4040], cnt, las, pa[4040], g[4040][10];
  inline void insert(int ch) {
    int newp = ++cnt, pos = las;
    las = cnt;
    len[newp] = len[pos] + 1;
    for (; pos && !g[pos][ch]; pos = pa[pos]) g[pos][ch] = newp;
    if (!pos)
      pa[newp] = 1;
    else {
      int posx = g[pos][ch];
      if (len[posx] == len[pos] + 1) {
        pa[newp] = posx;
      } else {
        int v = ++cnt;
        len[v] = len[pos] + 1;
        pa[v] = pa[posx];
        pa[posx] = pa[newp] = v;
        for (int i = 0; i < 10; i++) g[v][i] = g[posx][i];
        for (; pos && g[pos][ch] == posx; pos = pa[pos]) g[pos][ch] = v;
      }
    }
  }
} SAM;
int f[51][2][2][4001][30][2];
int dp(int len, bool limx, bool limy, pair<int, int> POS, bool OK) {
  if (!len) return OK;
  if (~f[len][limx][limy][POS.first][POS.second][OK])
    return f[len][limx][limy][POS.first][POS.second][OK];
  int sma = (limx ? X[len] : 0), big = (limy ? Y[len] : 9);
  long long res = 0;
  pair<int, int> nxt;
  for (int i = sma; i <= big; i++) {
    nxt = POS;
    if (!OK) {
      if (SAM.g[nxt.first][i]) {
        nxt.first = SAM.g[nxt.first][i];
        nxt.second++;
      } else {
        for (; nxt.first && !SAM.g[nxt.first][i]; nxt.first = SAM.pa[nxt.first])
          ;
        if (!nxt.first)
          nxt.first = 1, nxt.second = 0;
        else
          nxt.second = SAM.len[nxt.first] + 1, nxt.first = SAM.g[nxt.first][i];
      }
      res = (res + dp(len - 1, limx & (i == sma), limy & (i == big),
                      (nxt.second >= D / 2 ? make_pair(1, 0) : nxt),
                      (nxt.second >= D / 2))) %
            1000000007;
    } else {
      res = (res + dp(len - 1, limx & (i == sma), limy & (i == big),
                      make_pair(1, 0), 1)) %
            1000000007;
    }
  }
  f[len][limx][limy][POS.first][POS.second][OK] = res;
  return res;
}
int main() {
  SAM.cnt = SAM.las = 1;
  cin >> (S + 1);
  cin >> (X_ + 1);
  cin >> (Y_ + 1);
  D = strlen(Y_ + 1), n = strlen(S + 1);
  for (int i = 1; i <= n; i++) {
    SAM.insert(S[i] - '0');
  }
  for (int i = 1; i <= D; i++) {
    X[i] = X_[D - i + 1] - '0', Y[i] = Y_[D - i + 1] - '0';
  }
  memset(f, -1, sizeof f);
  cout << dp(D, 1, 1, make_pair(1, 0), 0);
  return 0;
}
