#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool getmin(T *a, const T &b) {
  if (b < *a) {
    *a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool getmax(T *a, const T &b) {
  if (b > *a) {
    *a = b;
    return true;
  }
  return false;
}
template <class T>
inline void read(T *a) {
  char c;
  while (isspace(c = getchar())) {
  }
  bool flag = 0;
  if (c == '-')
    flag = 1, *a = 0;
  else
    *a = c - 48;
  while (isdigit(c = getchar())) *a = *a * 10 + c - 48;
  if (flag) *a = -*a;
}
const int mo = 1000000007;
template <class T>
T pow(T a, T b, int c = mo) {
  T res = 1;
  for (T i = 1; i <= b; i <<= 1, a = 1LL * a * a % c)
    if (b & i) res = 1LL * res * a % c;
  return res;
}
const int N = 1001;
const int M = 51;
const int L = 26000;
char s[N], a[N];
int ch[L][10], fail[L];
int f[M][L][2];
bool dg[L];
int n, d;
queue<int> q;
int cnt;
void add(int a, int b) {
  int cur = 0;
  for (int i = (a); i <= (b); ++i) {
    int c = s[i] - '0';
    if (!ch[cur][c]) ch[cur][c] = ++cnt;
    cur = ch[cur][c];
  }
  dg[cur] = 1;
}
void bfs() {
  q.push(0);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = (0); i <= (9); ++i) {
      if (!ch[u][i])
        ch[u][i] = ch[fail[u]][i];
      else {
        if (!u)
          fail[ch[u][i]] = 0;
        else {
          fail[ch[u][i]] = ch[fail[u]][i];
          dg[ch[u][i]] |= dg[fail[ch[u][i]]];
        }
        q.push(ch[u][i]);
      }
    }
  }
}
int dp(int l, int u, bool x, bool e) {
  if (l > d) {
    return x;
  }
  if (!e && f[l][u][x] != -1) return f[l][u][x];
  int res = 0;
  int ed = e ? a[l] - '0' : 9;
  for (int i = (0); i <= (ed); ++i) {
    int v = ch[u][i];
    res = (res + dp(l + 1, v, x || dg[v], e && i == ed)) % mo;
  }
  if (!e) f[l][u][x] = res;
  return res;
}
bool check() {
  int u = 0;
  for (int i = (1); i <= (d); ++i) {
    int c = a[i] - '0';
    u = ch[u][c];
    if (dg[u]) return 1;
  }
  return 0;
}
int solve() { return dp(1, 0, 0, 1); }
int main() {
  scanf("%s", s + 1);
  scanf("%s", a + 1);
  int len = strlen(s + 1);
  d = strlen(a + 1);
  for (int i = (1); i <= (len - d / 2 + 1); ++i) add(i, i + d / 2 - 1);
  bfs();
  memset(f, 0xff, sizeof f);
  int ans = 0;
  ans = (mo - solve() + check()) % mo;
  scanf("%s", a + 1);
  ans = (ans + solve()) % mo;
  cout << ans << endl;
  return 0;
}
