#include <bits/stdc++.h>
using namespace std;
const int N = 101010;
const int qwq = 303030;
const int inf = 0x3f3f3f3f;
const int p = 1000000007;
int n, m, d;
int a[53];
char s[N], z1[53], z2[53];
int ch[N][10], ed[N], fa[N], cnt, now;
long long f[53][25678][2][2];
vector<int> e[N];
queue<int> q;
inline int read() {
  int sum = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    sum = sum * 10 + c - '0';
    c = getchar();
  }
  return sum * f;
}
void DFS(int u, bool flag) {
  if (ed[u]) flag = 1;
  if (flag) ed[u] = 1;
  for (int i = 0; i < e[u].size(); i++) DFS(e[u][i], flag);
}
void AC() {
  n = strlen(s + 1);
  for (int i = 1; i + d / 2 - 1 <= n; i++) {
    now = 0;
    for (int j = i; j <= i + d / 2 - 1; j++) {
      int c = s[j] - '0';
      if (!ch[now][c]) ch[now][c] = ++cnt;
      now = ch[now][c];
    }
    ed[now] = 1;
  }
  for (int i = 0; i < 10; i++)
    if (ch[0][i]) q.push(ch[0][i]);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = 0; i < 10; i++) {
      int v = ch[u][i];
      if (v) {
        fa[v] = ch[fa[u]][i];
        q.push(v);
      } else
        ch[u][i] = ch[fa[u]][i];
    }
  }
  for (int i = 1; i <= cnt; i++) e[fa[i]].push_back(i);
  DFS(0, 0);
}
int query() {
  long long ans = 0;
  memset(f, 0, sizeof(f));
  f[0][0][1][0] = 1;
  for (int i = 1; i <= d; i++) {
    for (int j = 0; j <= cnt; j++) {
      for (int k = 0; k < 10; k++) {
        int v = ch[j][k];
        if (k < a[i]) {
          if (ed[v]) {
            (f[i][v][0][1] += f[i - 1][j][1][1] + f[i - 1][j][0][1] +
                              f[i - 1][j][1][0] + f[i - 1][j][0][0]) %= p;
          } else {
            (f[i][v][0][1] += f[i - 1][j][1][1] + f[i - 1][j][0][1]) %= p;
            (f[i][v][0][0] += f[i - 1][j][1][0] + f[i - 1][j][0][0]) %= p;
          }
        }
        if (k == a[i]) {
          if (ed[v]) {
            (f[i][v][1][1] += f[i - 1][j][1][1] + f[i - 1][j][1][0]) %= p;
            (f[i][v][0][1] += f[i - 1][j][0][1] + f[i - 1][j][0][0]) %= p;
          } else {
            (f[i][v][1][1] += f[i - 1][j][1][1]) %= p;
            (f[i][v][1][0] += f[i - 1][j][1][0]) %= p;
            (f[i][v][0][1] += f[i - 1][j][0][1]) %= p;
            (f[i][v][0][0] += f[i - 1][j][0][0]) %= p;
          }
        }
        if (k > a[i]) {
          if (ed[v]) {
            (f[i][v][0][1] += f[i - 1][j][0][1] + f[i - 1][j][0][0]) %= p;
          } else {
            (f[i][v][0][1] += f[i - 1][j][0][1]) %= p;
            (f[i][v][0][0] += f[i - 1][j][0][0]) %= p;
          }
        }
      }
    }
  }
  for (int i = 0; i <= cnt; i++) (ans += f[d][i][1][1] + f[d][i][0][1]) %= p;
  return ans;
}
int main() {
  scanf("%s", s + 1);
  scanf("%s%s", z1 + 1, z2 + 1);
  d = strlen(z1 + 1);
  AC();
  for (int i = 1; i <= d; i++) a[i] = z1[i] - '0';
  int h = d;
  while (a[h] == 0) a[h] = 9, h--;
  a[h]--;
  long long ans1 = query();
  for (int i = 1; i <= d; i++) a[i] = z2[i] - '0';
  long long ans2 = query();
  cout << ((ans2 - ans1) % p + p) % p;
  return 0;
}
