#include <bits/stdc++.h>
char S[1050], A[70], B[70];
int len, D;
const int mod = 1000000007;
struct ACautomaton {
  struct node {
    int son[10], dep, fail;
    bool ed;
  } T[50000];
  int tot;
  void insert(char *S, int len = -1) {
    if (!~len) len = strlen(S);
    int now = 1;
    for (int i = 0; i < len; i++) {
      int &nxt = T[now].son[S[i] - '0'];
      if (!nxt) nxt = ++tot;
      T[nxt].dep = T[now].dep + 1;
      now = nxt;
    }
    T[now].ed = true;
  }
  void make() {
    std::queue<int> Q;
    for (int i = 0; i < 10; i++) {
      if (T[1].son[i])
        Q.push(T[1].son[i]), T[T[1].son[i]].fail = 1;
      else
        T[1].son[i] = 1;
    }
    while (!Q.empty()) {
      int now = Q.front();
      Q.pop();
      for (int i = 0; i < 10; i++) {
        if (T[now].son[i])
          Q.push(T[now].son[i]), T[T[now].son[i]].fail = T[T[now].fail].son[i];
        else
          T[now].son[i] = T[T[now].fail].son[i];
      }
    }
  }
  ACautomaton() { tot = 1; }
} T;
inline void chkinc(int &A) { A += A >> 31 & mod; }
int dp[55][50000][2][2][2];
int DP(int now, int pos, bool upper = true, bool lower = true,
       bool vis = false) {
  if (now == D) return vis;
  int &nowdp = dp[now][pos][upper][lower][vis];
  if (~nowdp) return nowdp;
  int L = lower ? A[now] - '0' : 0, R = upper ? B[now] - '0' : 9;
  nowdp = 0;
  for (int i = L; i <= R; i++)
    chkinc(nowdp += DP(now + 1, T.T[pos].son[i], upper && i == R,
                       lower && i == L, vis || T.T[T.T[pos].son[i]].ed) -
                    mod);
  return nowdp;
}
int main() {
  memset(dp, 0xff, sizeof(dp));
  scanf("%s%s%s", S, A, B);
  len = strlen(S);
  D = strlen(A);
  if (D / 2 > len) return puts("0"), 0;
  for (int i = 0; i < len - D / 2 + 1; i++) T.insert(S + i, D / 2);
  T.make();
  printf("%d\n", DP(0, 1));
}
