#include <bits/stdc++.h>
using namespace std;
const int N = 1005, M = 55, L = N * M, Mod = 1e9 + 7;
char s[N], x[M], y[M], po[M], g[M];
int n, d, ch[L][10], fail[L], f[M][L][2], cnt = 1;
bool ed[L];
inline void upd(int& x, int y) { x = (x + y >= Mod ? x + y - Mod : x + y); }
inline int sub(int x, int y) { return (x - y < 0 ? x - y + Mod : x - y); }
void insert(int l, int r) {
  int u = 1;
  for (int i = l; i <= r; ++i) {
    if (!ch[u][s[i]]) ch[u][s[i]] = ++cnt;
    u = ch[u][s[i]];
  }
  ed[u] = true;
}
inline int solve(char* s) {
  for (int i = 1; i <= d; ++i) s[i] -= '0';
  memset(f, 0, sizeof(f));
  f[0][1][1] = 1;
  for (int i = 1; i <= d; ++i)
    for (int u = 1; u <= cnt; ++u)
      if (!ed[u])
        for (int j = 0; j < 10; ++j)
          if (ch[u][j]) {
            const int v = ch[u][j];
            upd(f[i][v][0], f[i - 1][u][0]);
            if (s[i] > j) upd(f[i][v][0], f[i - 1][u][1]);
            if (s[i] == j) upd(f[i][v][1], f[i - 1][u][1]);
          }
  int ans = 0;
  for (int i = d, x = 1, y = 1; i; --i) {
    for (int u = 1; u <= cnt; ++u)
      if (ed[u])
        upd(ans, (1ll * (f[i][u][0]) * (x) % Mod)),
            upd(ans, (1ll * (f[i][u][1]) * (y) % Mod));
    upd(y, (1ll * (x) * (s[i]) % Mod)), x = (1ll * (x) * (10) % Mod);
  }
  return ans;
}
int main() {
  scanf("%s%s%s", s + 1, x + 1, y + 1);
  n = strlen(s + 1), d = strlen(x + 1);
  for (int i = d; i; --i) {
    if (x[i] == '0')
      x[i] = '9';
    else {
      --x[i];
      break;
    }
  }
  for (int i = 1; i <= n; ++i) s[i] -= '0';
  for (int i = 1; i <= n - d / 2 + 1; ++i) insert(i, i + d / 2 - 1);
  queue<int> q;
  q.push(1);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = 0; i < 10; ++i) {
      if (!ch[u][i])
        ch[u][i] = (fail[u] ? ch[fail[u]][i] : 1);
      else
        fail[ch[u][i]] = (fail[u] ? ch[fail[u]][i] : 1), q.push(ch[u][i]);
    }
  }
  printf("%d\n", sub(solve(y), solve(x)));
}
