#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 1e3 + 10;
char s[N], x[N], y[N];
int n, d;
namespace Trie {
const int M = N * 60;
int ch[M][10], tot = 1, rt = 1, fail[M];
bool ed[M];
inline void insert(int l, int r) {
  int now = rt;
  for (int i = l; i <= r; ++i) {
    int v = s[i] - '0';
    if (!ch[now][v]) ch[now][v] = ++tot;
    now = ch[now][v];
  }
  ed[now] = true;
}
inline void getfail() {
  for (int i = 0; i < 10; ++i) ch[0][i] = rt;
  fail[rt] = 0;
  queue<int> q;
  q.push(rt);
  while (!q.empty()) {
    int u = q.front();
    q.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], q.push(ch[u][i]);
    }
  }
}
}  // namespace Trie
using namespace Trie;
int dp[2][N * 50][2][2][2];
inline void upd(int &x, int y) { x = (x + y >= mod) ? x + y - mod : x + y; }
int main() {
  scanf("%s%s%s", s + 1, x + 1, y + 1);
  n = strlen(s + 1);
  d = strlen(x + 1);
  int nd = d / 2;
  for (int i = 1; i + nd - 1 <= n; ++i) insert(i, i + nd - 1);
  getfail();
  dp[0][rt][1][1][0] = 1;
  for (int i = 1; i <= d; ++i) {
    int cur = i & 1, last = !cur;
    for (int pos = 0; pos <= tot; ++pos)
      for (int limx = 0; limx <= 1; ++limx)
        for (int limy = 0; limy <= 1; ++limy)
          for (int ok = 0; ok <= 1; ++ok) {
            int &d = dp[last][pos][limx][limy][ok];
            if (!d) continue;
            int s = limx ? x[i] - '0' : 0, t = limy ? y[i] - '0' : 9;
            for (int c = s; c <= t; ++c) {
              int npos = ch[pos][c];
              upd(dp[cur][npos][limx && c == x[i] - '0']
                    [limy && c == y[i] - '0'][ok | ed[npos]],
                  d);
            }
            d = 0;
          }
  }
  int ans = 0;
  for (int pos = 0; pos <= tot; ++pos)
    for (int limx = 0; limx <= 1; ++limx)
      for (int limy = 0; limy <= 1; ++limy)
        upd(ans, dp[d & 1][pos][limx][limy][1]);
  printf("%d\n", ans);
  return 0;
}
