#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
struct acatm {
  static const int maxt = 25004;
  int ch[maxt][10], cur;
  int f[maxt];
  bool match[maxt];
  acatm() { cur = 1; }
  void ins(char *s, int l) {
    int now = 1;
    for (int i = 0; i < l; i++) {
      int &v = ch[now][s[i] - '0'];
      if (!v) v = ++cur;
      now = v;
    }
    match[now] = true;
  }
  int q[maxt];
  void getfail() {
    int l = 1, r = 0;
    f[1] = 1;
    for (int i = 0; i < 10; i++) {
      int &u = ch[1][i];
      if (u)
        q[++r] = u, f[u] = 1;
      else
        u = 1;
    }
    while (l <= r) {
      int u = q[l++];
      for (int i = 0; i < 10; i++) {
        int &v = ch[u][i];
        if (!v) {
          v = ch[f[u]][i];
          continue;
        }
        f[v] = ch[f[u]][i];
        q[++r] = v;
      }
    }
    for (int i = 1; i <= cur; i++)
      for (int j = 0; j < 10; j++)
        if (match[ch[i][j]]) {
          ch[i][j] = cur + 1;
        }
    cur++;
    for (int i = 0; i < 10; i++) ch[cur][i] = cur;
  }
} t;
int f[4][acatm::maxt], g[4][acatm::maxt];
int to[10];
char s[1003], l[52], r[52];
int main() {
  scanf("%s%s%s", s, l, r);
  int d = strlen(l), n = strlen(s);
  for (int i = 0; i <= n - d / 2; i++) t.ins(s + i, d / 2);
  t.getfail();
  g[0][1] = 1;
  for (int i = 0; i < d; i++) {
    for (int j = 0; j < 4; j++)
      for (int k = 1; k <= t.cur; k++) f[j][k] = 0;
    for (int j = 0; j < 4; j++) {
      int st = j % 2 ? 0 : l[i] - '0', en = j / 2 ? 9 : r[i] - '0';
      if (st > en) continue;
      for (int k = st; k <= en; k++) to[k] = 3;
      if (j % 2 == 0) to[st] &= 2;
      if (j / 2 == 0) to[en] &= 1;
      for (int k = 1; k <= t.cur; k++) {
        if (!g[j][k]) continue;
        for (int o = st; o <= en; o++) {
          (f[to[o]][t.ch[k][o]] += g[j][k]) %= mod;
        }
      }
    }
    for (int j = 0; j < 4; j++) swap(f[j], g[j]);
  }
  int ans = 0;
  for (int i = 0; i <= 3; i++) (ans += g[i][t.cur]) %= mod;
  printf("%d", ans);
}
