#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
char s[1034], L[1034], R[1034];
int n, D, d;
int i, j, k, l, r;
int dig, nj, nk;
long long f[55][25610][8], ans = 0;
namespace AcAM {
int cnt = 1;
int d[25610][10], v[25610], f[25610], la[25610];
int que[25610];
void insert(char *_beg, char *_end) {
  char *p;
  int t = 1, id;
  for (p = _beg; p != _end; ++p) {
    id = *p & 15;
    t = (d[t][id] ? d[t][id] : (d[t][id] = ++cnt));
  }
  v[t] = 1;
}
void Build_Ac_AM() {
  int h, ta = 1, i, t, id;
  que[0] = 1;
  f[1] = 0;
  for (h = 0; h < ta; ++h)
    for (i = que[h], id = 0; id < 10; ++id) {
      t = (f[i] ? d[f[i]][id] : 1);
      int &u = d[i][id];
      if (!u) {
        u = t;
        continue;
      }
      f[u] = t;
      que[ta++] = u;
      la[u] = (v[t] ? t : la[t]);
    }
}
}  // namespace AcAM
inline void add(long long &A, const long long B) {
  (A += B) >= mod ? A -= mod : 0;
}
int main() {
  scanf("%s%s%s", s, L, R);
  n = strlen(s);
  D = strlen(L);
  d = D >> 1;
  for (i = 0; i <= n - d; ++i) AcAM::insert(s + i, s + (i + d));
  AcAM::Build_Ac_AM();
  f[0][1][3] = 1;
  for (i = 0; i < D; ++i)
    for (j = 1; j <= AcAM::cnt; ++j)
      for (k = 0; k < 8; ++k)
        if (f[i][j][k]) {
          l = (k & 2 ? L[i] & 15 : 0);
          r = (k & 1 ? R[i] & 15 : 9);
          for (dig = l; dig <= r; ++dig) {
            nj = AcAM::d[j][dig];
            nk = k & (dig == l ? -1 : -3) & (dig == r ? -1 : -2);
            nk |= AcAM::v[nj] << 2;
            add(f[i + 1][nj][nk], f[i][j][k]);
          }
        }
  for (j = 1; j <= AcAM::cnt; ++j)
    for (k = 4; k < 8; ++k) add(ans, f[D][j][k]);
  printf("%lld\n", ans);
  return 0;
}
