#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long x = 0, f = 0;
  char ch = getchar();
  while (!isdigit(ch)) f = ch == '-', ch = getchar();
  while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
  return f ? -x : x;
}
const int N = 1005, D = 55, S = N * D, mod = 1e9 + 7;
void Add(int &x, int y) {
  if ((x += y) >= mod) x -= mod;
}
void Del(int &x, int y) {
  if ((x -= y) < 0) x += mod;
}
int Add(int x) { return x >= mod ? x - mod : x; }
int Del(int x) { return x < 0 ? x + mod : x; }
int n, d;
string s, sa, sb;
int cnt = 1;
int Next[S][10], Fail[S], f[S];
void Ins(string s) {
  int x = 1;
  for (int i = (0); i <= (d / 2 - 1); i++) {
    int k = s[i] - '0';
    if (!Next[x][k]) Next[x][k] = ++cnt;
    x = Next[x][k];
  }
  f[x] = 1;
}
void Build() {
  static int q[S];
  int head = 0, tail = 0;
  Fail[1] = 0, Fail[0] = 1;
  for (int i = (0); i <= (9); i++) Next[0][i] = 1;
  q[++tail] = 1;
  while (head < tail) {
    int x = q[++head];
    for (int i = (0); i <= (9); i++) {
      if (!Next[x][i]) {
        Next[x][i] = Next[Fail[x]][i];
        continue;
      }
      int y = Next[x][i];
      Fail[y] = Next[Fail[x]][i];
      q[++tail] = y;
    }
  }
}
int v[D][S][4];
int main() {
  cin >> s >> sa >> sb;
  n = s.size(), d = sa.size();
  for (int i = (0); i <= (n - d / 2); i++) Ins(s.substr(i, d / 2));
  Build();
  for (int i = (1); i <= (cnt); i++)
    if (f[i])
      for (int j = (0); j <= (9); j++) Next[i][j] = i;
  memset(v, 0, sizeof v);
  v[0][1][3] = 1;
  sa = " " + sa, sb = " " + sb;
  for (int i = (1); i <= (d); i++) {
    for (int j = (1); j <= (cnt); j++)
      for (int k = (0); k <= (3); k++) {
        int val = v[i - 1][j][k];
        if (!val) continue;
        int lb = k & 1 ? sa[i] - '0' : 0;
        int ub = k & 2 ? sb[i] - '0' : 9;
        for (int t = (lb); t <= (ub); t++)
          Add(v[i][Next[j][t]]
               [k & (int)((t == lb) + 2) & (int)(((t == ub) << 1) + 1)],
              val);
      }
  }
  int ans = 0;
  for (int i = (1); i <= (cnt); i++)
    if (f[i])
      for (int j = (0); j <= (3); j++) Add(ans, v[d][i][j]);
  cout << ans << endl;
  return 0;
}
