#include <bits/stdc++.h>
using namespace std;
const int P = 1e9 + 7;
const int MAXN = 1e3 + 7, D = 53, K = 11;
int n, d, trie[MAXN * D][K], ed[MAXN * D], fail[MAXN * D], T = 1;
char s[MAXN], a[D], b[D];
long long p[MAXN][2], f[D][MAXN * D][2];
inline void build() {
  int m = d / 2;
  for (int i = 1; i + m - 1 <= n; ++i) {
    int p = 1;
    for (int j = i, k = 1; k <= m; ++j, ++k) {
      int c = s[j] - '0';
      if (!trie[p][c]) trie[p][c] = ++T;
      p = trie[p][c];
    }
    ed[p] = 1;
  }
  queue<int> q;
  for (int i = 0; i < 10; ++i) {
    if (trie[1][i])
      fail[trie[1][i]] = 1, q.push(trie[1][i]);
    else
      trie[1][i] = 1;
  }
  while (q.size()) {
    int x = q.front();
    q.pop();
    for (int i = 0; i < 10; ++i) {
      if (trie[x][i])
        fail[trie[x][i]] = trie[fail[x]][i], q.push(trie[x][i]);
      else
        trie[x][i] = trie[fail[x]][i];
    }
  }
}
inline long long calc(char *t) {
  p[d + 1][0] = p[d + 1][1] = 1;
  for (int i = d; i; i--) {
    p[i][0] = p[i + 1][0] * 10 % P;
    p[i][1] = ((t[i] - '0') * p[i + 1][0] % P + p[i + 1][1]) % P;
  }
  long long ans = 0;
  for (int i = 1; i <= d; ++i) {
    for (int j = 1; j <= T; ++j) {
      for (int k = 0; k < 2; ++k) {
        f[i][j][k] = 0;
      }
    }
  }
  f[0][1][1] = 1;
  for (int i = 0; i < d; ++i) {
    for (int j = 1; j <= T; ++j) {
      if (!ed[j]) {
        for (int k = 0; k < 10; ++k) {
          int o = trie[j][k];
          (f[i + 1][o][0] = (f[i + 1][o][0] + f[i][j][0]) % P);
          if (k < t[i + 1] - '0')
            (f[i + 1][o][0] = (f[i + 1][o][0] + f[i][j][1]) % P);
          if (k == t[i + 1] - '0')
            (f[i + 1][o][1] = (f[i + 1][o][1] + f[i][j][1]) % P);
        }
      }
    }
  }
  for (int i = 1; i <= d; ++i) {
    for (int j = 1; j <= T; ++j) {
      if (ed[j]) {
        ans = (ans +
               (f[i][j][0] * p[i + 1][0] % P + f[i][j][1] * p[i + 1][1] % P) %
                   P) %
              P;
      }
    }
  }
  ans %= P;
  return ans;
}
int main() {
  cin >> s + 1;
  cin >> a + 1;
  cin >> b + 1;
  n = strlen(s + 1);
  d = strlen(a + 1);
  build();
  int k = d;
  while (a[k] == '0') a[k--] = '9';
  --a[k];
  printf("%lld\n", ((calc(b) - calc(a)) % P + P) % P);
  return 0;
}
