#include <bits/stdc++.h>
using namespace std;
const long long N = 500005;
const long long inf = 1e9;
const long long Inf = 1e10;
const long long P = 1000000007;
bool st;
int f[2][N][2][2][2];
char s[1005];
int tre[N][10], fa[N], len[N], cnt = 1, n;
int Q[N], r;
bool en;
void ACbuild() {
  for (int i = (int)(0); i < (int)(10); i++)
    if (tre[1][i]) {
      fa[Q[++r] = tre[1][i]] = 1;
    } else
      tre[1][i] = 1;
  for (int i = (int)(1); i <= (int)(r); i++) {
    int u = Q[i];
    for (int j = (int)(0); j < (int)(10); j++) {
      if (!tre[u][j])
        tre[u][j] = tre[fa[u]][j];
      else
        fa[Q[++r] = tre[u][j]] = tre[fa[u]][j];
    }
  }
}
void A(int &x, int y) {
  x += y;
  if (x >= P) x -= P;
}
char xia[55], shang[55];
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (int i = (int)(1); i <= (int)(n); i++) {
    int p = 1;
    for (int j = (int)(i); j <= (int)(n); j++) {
      int &v = tre[p][s[j] - 48];
      if (!v) len[v = ++cnt] = len[p] + 1;
      p = v;
    }
  }
  scanf("%s", xia + 1);
  scanf("%s", shang + 1);
  int lim = strlen(xia + 1);
  ACbuild();
  int p = 0, q = 0;
  f[p][1][0][0][0] = 1;
  for (int i = (int)(1); i <= (int)(lim); i++) {
    p ^= 1, q = p ^ 1;
    memset(f[p], 0, sizeof f[p]);
    for (int j = (int)(1); j <= (int)(cnt); j++)
      for (int u = (int)(0); u <= (int)(1); u++)
        for (int v = (int)(0); v <= (int)(1); v++)
          for (int w = (int)(0); w <= (int)(1); w++) {
            int cur = f[q][j][u][v][w];
            if (!cur) continue;
            int D = u ? 0 : (xia[i] - 48);
            int U = v ? 9 : (shang[i] - 48);
            for (int x = (int)(D); x <= (int)(U); x++) {
              int tr = tre[j][x];
              int nu = u | (x > D);
              int nv = v | (x < U);
              int nw = w | (len[tr] >= lim / 2);
              A(f[p][tr][nu][nv][nw], cur);
            }
          }
  }
  int ans = 0;
  for (int u = (int)(1); u <= (int)(cnt); u++)
    for (int X = (int)(0); X <= (int)(1); X++)
      for (int Y = (int)(0); Y <= (int)(1); Y++) {
        A(ans, f[p][u][X][Y][1]);
      }
  printf("%d\n", ans);
  return 0;
}
