#include <bits/stdc++.h>
using namespace std;
const int N = 1010, M = 52;
const int mod = 1e9 + 7;
int trie[N * 25][10], ncnt, n, dep[N * 25], len;
char s[N];
inline void insert(int l) {
  int nw = 0;
  for (int i = l; i <= min(n, l + len / 2 - 1); i++) {
    int t = s[i] - '0';
    if (trie[nw][t])
      nw = trie[nw][t];
    else {
      ncnt++, dep[ncnt] = dep[nw] + 1;
      nw = trie[nw][t] = ncnt;
    }
  }
}
int fail[N * 25];
inline void Getfail() {
  queue<int> q;
  for (int i = 0; i < 10; i++)
    if (trie[0][i]) q.push(trie[0][i]);
  while (!q.empty()) {
    int u = q.front(), f = fail[u];
    q.pop();
    for (int i = 0; i < 10; i++) {
      int v = trie[u][i];
      if (!v)
        trie[u][i] = trie[f][i];
      else
        fail[v] = trie[f][i], q.push(v);
    }
  }
}
int dp[2][2][M][N * 25], L[M], R[M];
int DP(int cur, int at, int up, int down) {
  if (cur == len + 1) return dep[at] >= len / 2;
  if (~dp[up][down][cur][at]) return dp[up][down][cur][at];
  int &sum = dp[up][down][cur][at];
  sum = 0;
  int l = down ? L[cur] : 0, r = up ? R[cur] : 9;
  for (int i = l; i <= r; i++) {
    int nxt = dep[at] >= len / 2 ? at : trie[at][i];
    sum = (sum + DP(cur + 1, nxt, up && i == r, down && i == l)) % mod;
  }
  return sum;
}
char A[M], B[M];
int main() {
  scanf("%s", s + 1), n = strlen(s + 1);
  scanf("%s%s", A + 1, B + 1), len = strlen(A + 1);
  for (int i = 1; i <= n; i++) insert(i);
  Getfail();
  for (int i = 1; i <= len; i++) L[i] = A[i] - '0', R[i] = B[i] - '0';
  memset(dp, -1, sizeof(dp));
  printf("%d\n", DP(1, 0, 1, 1));
  return 0;
}
