#include <bits/stdc++.h>
using namespace std;
const int NN = 25000 + 117;
const int MM = 52;
const int mod = 1e9 + 7;
int read() {
  int fl = 1, x;
  char c;
  for (c = getchar(); (c < '0' || c > '9') && c != '-'; c = getchar())
    ;
  if (c == '-') {
    fl = -1;
    c = getchar();
  }
  for (x = 0; c >= '0' && c <= '9'; c = getchar())
    x = (x << 3) + (x << 1) + c - '0';
  return x * fl;
}
void open() { freopen("a.in", "r", stdin); }
void close() {
  fclose(stdin);
  fclose(stdout);
}
struct node {
  int s[10];
  bool vis;
  int fail;
} t[NN] = {};
int tcnt = 1;
int rt = 1;
queue<int> q;
void insert(int st, int fin, char s[]) {
  int pos = rt;
  for (int i = st; i <= fin; ++i) {
    if (!t[pos].s[s[i]]) {
      t[pos].s[s[i]] = ++tcnt;
    }
    pos = t[pos].s[s[i]];
  }
  t[pos].vis = 1;
}
void getfail() {
  q.push(rt);
  for (int i = 0; i < 10; ++i) t[0].s[i] = rt;
  while (!q.empty()) {
    int pos = q.front();
    q.pop();
    t[pos].vis |= t[t[pos].fail].vis;
    for (int i = 0; i < 10; ++i) {
      if (t[pos].s[i]) {
        t[t[pos].s[i]].fail = t[t[pos].fail].s[i];
        q.push(t[pos].s[i]);
      } else {
        t[pos].s[i] = t[t[pos].fail].s[i];
      }
    }
  }
}
char s[NN] = {};
char x[MM], y[MM] = {};
int n, m;
void trans(char s[], int m) {
  for (int i = 1; i <= m; ++i) s[i] -= '0';
}
bool chk(char s[]) {
  int pos = rt;
  for (int i = 1; i <= n; ++i) {
    pos = t[pos].s[s[i]];
    if (t[pos].vis) return true;
  }
  return false;
}
long long getnum(char s[]) {
  long long res = 0;
  for (int i = 1; i <= n; ++i) res = (res * 10 + s[i]) % mod;
  return res;
}
long long dp[MM][NN][2] = {};
void upd(long long &x, long long y) { x = (x + y) % mod; }
long long calc(char s[]) {
  long long res = getnum(s);
  memset(dp, 0, sizeof dp);
  dp[0][1][0] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= tcnt; ++j) {
      if (t[j].vis) continue;
      for (int k = 0; k < 10; ++k) {
        upd(dp[i][t[j].s[k]][1], dp[i - 1][j][1]);
        if (k < s[i]) upd(dp[i][t[j].s[k]][1], dp[i - 1][j][0]);
        if (k == s[i]) upd(dp[i][t[j].s[k]][0], dp[i - 1][j][0]);
      }
    }
  }
  for (int j = 1; j <= tcnt; ++j) {
    if (!t[j].vis) res = (res - dp[n][j][1]) % mod;
  }
  return res;
}
int main() {
  scanf("%s", s + 1);
  scanf("%s", x + 1);
  scanf("%s", y + 1);
  n = strlen(x + 1);
  m = strlen(s + 1);
  trans(s, m);
  trans(x, n);
  trans(y, n);
  for (int i = 1; i + n / 2 - 1 <= m; ++i) {
    insert(i, i + n / 2 - 1, s);
  }
  getfail();
  long long ans = 0;
  ans += chk(y);
  ans += calc(y);
  ans -= calc(x);
  ans %= mod;
  ans = (ans + mod) % mod;
  printf("%lld\n", ans);
  close();
  return 0;
}
