#include <bits/stdc++.h>
using namespace std;
char buf[(1 << 21) + 5], *p1 = buf, *p2 = buf;
inline int qread() {
  char c =
      (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2)
           ? EOF
           : *p1++);
  int x = 0, f = 1;
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2)
             ? EOF
             : *p1++);
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2)
             ? EOF
             : *p1++);
  }
  return x * f;
}
const long long mod = 1000000007;
char s[1005], l[55], r[55], cur[55];
int ch[25555][10], fail[25555], dep[25555], top, n, m;
long long dp[55][25555][2], sufv[55], p10[55];
inline void Build() {
  top = 1;
  for (int sl = 1; sl <= n; sl++) {
    int sr = min(sl + 26, n);
    int p = 1;
    for (int i = sl; i <= sr; i++) {
      if (!ch[p][s[i] - '0']) ch[p][s[i] - '0'] = ++top;
      p = ch[p][s[i] - '0'];
      dep[p] = i - sl + 1;
    }
  }
  for (int i = 0; i < 10; i++) ch[0][i] = 1;
  queue<int> que;
  que.push(1);
  while (!que.empty()) {
    int u = que.front();
    que.pop();
    for (int i = 0; i < 10; i++) {
      if (!ch[u][i])
        ch[u][i] = ch[fail[u]][i];
      else {
        fail[ch[u][i]] = ch[fail[u]][i];
        que.push(ch[u][i]);
      }
    }
  }
}
inline long long Add(long long x, long long y) {
  return (x + y >= mod ? x + y - mod : x + y);
}
inline long long Minus(long long x, long long y) {
  return (x < y ? x - y + mod : x - y);
}
inline long long Dfs(int i, int u, bool f, bool g) {
  if (i == m + 1) return f;
  if (f) {
    if (!g) return p10[m - i + 1];
    return (sufv[i] + 1) % mod;
  }
  if (~dp[i][u][g]) return dp[i][u][g];
  long long& ans = dp[i][u][g];
  ans = 0;
  int up = (g ? cur[i] - '0' : 9);
  for (int nxt = 0; nxt <= up; nxt++) {
    ans = Add(ans, Dfs(i + 1, ch[u][nxt], dep[ch[u][nxt]] >= m / 2,
                       g && (nxt == up)));
  }
  return ans;
}
inline long long Calc(char* str) {
  for (int i = 1; i <= m; i++) cur[i] = str[i];
  p10[0] = 1;
  for (int i = 1; i <= m; i++) p10[i] = p10[i - 1] * 10 % mod;
  for (int i = m; i >= 1; i--) {
    sufv[i] = (sufv[i + 1] + (cur[i] - '0') * p10[m - i] % mod) % mod;
  }
  memset(dp, -1, sizeof(dp));
  return Dfs(1, 1, 0, 1);
}
inline void Solve() {
  long long ans = Minus(Calc(r), Calc(l));
  int p = 1;
  for (int i = 1; i <= m; i++) {
    p = ch[p][l[i] - '0'];
    if (dep[p] >= m / 2) {
      ans++;
      break;
    }
  }
  ans %= mod;
  printf("%lld", ans);
}
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  scanf("%s", l + 1);
  scanf("%s", r + 1);
  m = strlen(r + 1);
  Build();
  Solve();
  return 0;
}
