#include <bits/stdc++.h>
using namespace std;
const long long N = 200005;
const long long M = 1000000007;
long long n, d;
string s, t1, t2, t;
long long rt = 1, tot = 1, ch[15][N], ed[N], fail[N];
void insert(string x) {
  long long len = x.length(), now = rt;
  for (long long i = 0; i < len; i++) {
    if (!ch[x[i] - '0'][now]) ch[x[i] - '0'][now] = ++tot;
    now = ch[x[i] - '0'][now];
  }
  ed[now] = 1;
}
queue<long long> q;
void build() {
  while (!q.empty()) q.pop();
  for (long long i = 0; i < 10; i++) {
    if (ch[i][rt]) {
      fail[ch[i][rt]] = rt;
      q.push(ch[i][rt]);
    } else
      ch[i][rt] = rt;
  }
  while (!q.empty()) {
    long long u = q.front();
    q.pop();
    for (long long i = 0; i < 10; i++) {
      if (ch[i][u]) {
        fail[ch[i][u]] = ch[i][fail[u]];
        q.push(ch[i][u]);
      } else
        ch[i][u] = ch[i][fail[u]];
    }
  }
}
void prep() {
  for (long long i = 1; i <= n; i++) {
    if (i + d / 2 - 1 > n) break;
    t = "";
    for (long long j = 1; j <= d / 2; j++) t += s[i + j - 1];
    insert(t);
  }
  build();
}
string minusone(string x) {
  x[d - 1]--;
  for (long long i = d - 1; i >= 0; i--) {
    if (x[i] < '0') {
      x[i] = '9';
      x[i - 1]--;
    }
  }
  return x;
}
long long g[2][55], dp[2][55][N];
long long calc(string x) {
  memset(g, 0, sizeof(g));
  memset(dp, 0, sizeof(dp));
  dp[1][0][1] = 1;
  g[0][d] = 1;
  g[1][d] = 1;
  for (long long i = d - 1; i >= 1; i--) {
    g[0][i] = (g[0][i + 1] * 10) % M;
    g[1][i] = (g[1][i + 1] + (x[i + 1] - '0') * g[0][i + 1]) % M;
  }
  for (long long i = 0; i < d; i++) {
    for (long long j = 1; j <= tot; j++) {
      if (ed[j]) continue;
      for (long long k = 0; k < 10; k++) {
        long long to = ch[k][j];
        dp[0][i + 1][to] = (dp[0][i + 1][to] + dp[0][i][j]) % M;
        if (k < x[i + 1] - '0')
          dp[0][i + 1][to] = (dp[0][i + 1][to] + dp[1][i][j]) % M;
        if (k == x[i + 1] - '0')
          dp[1][i + 1][to] = (dp[1][i + 1][to] + dp[1][i][j]) % M;
      }
    }
  }
  long long ret = 0;
  for (long long i = 1; i <= d; i++) {
    for (long long j = 1; j <= tot; j++) {
      if (ed[j])
        ret = (ret + dp[0][i][j] * g[0][i] + dp[1][i][j] * g[1][i]) % M;
    }
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> s;
  n = s.length();
  s = ' ' + s;
  cin >> t1 >> t2;
  d = t1.length();
  t1 = minusone(t1);
  t1 = ' ' + t1;
  t2 = ' ' + t2;
  prep();
  cout << (calc(t2) - calc(t1) + M) % M << '\n';
  return 0;
}
