#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
template <class T, class U>
inline void Max(T &a, U b) {
  if (a < b) a = b;
}
template <class T, class U>
inline void Min(T &a, U b) {
  if (a > b) a = b;
}
char s[1005], a[55], b[55];
struct trie {
  int ch[10], v, fail;
  void init() {
    memset(ch, 0, sizeof(ch));
    v = 0;
    fail = 0;
  }
} t[25005];
int sz, n, m, dp[55][25005][2][2][2], pw[55];
int dfs(int first, int rt, int p, int q, int k) {
  if (first == m) {
    return k;
  }
  int &ret = dp[first][rt][p][q][k];
  if (ret + 1) return ret;
  ret = 0;
  if (k) {
    if (p && q) return ret = pw[m - first];
    for (int i = 0; i < 10; i++) {
      if (p == 0 && a[first] > i) continue;
      if (q == 0 && b[first] < i) continue;
      ret += dfs(first + 1, rt, p | (i > a[first]), q | (i < b[first]), k);
      if (ret >= 1000000007) ret -= 1000000007;
    }
    return ret;
  }
  for (int i = 0; i < 10; i++) {
    if (p == 0 && a[first] > i) continue;
    if (q == 0 && b[first] < i) continue;
    int j = t[rt].ch[i];
    if (k)
      ret += dfs(first + 1, rt, p | (i > a[first]), q | (i < b[first]), 1);
    else
      ret += dfs(first + 1, j, p | (i > a[first]), q | (i < b[first]), t[j].v);
    if (ret >= 1000000007) ret -= 1000000007;
  }
  return ret;
}
int main() {
  int T, i, j, k;
  pw[0] = 1;
  for (i = 1; i <= 50; i++) pw[i] = pw[i - 1] * 10LL % 1000000007;
  scanf("%s%s%s", s, a, b);
  m = strlen(a);
  n = strlen(s);
  for (i = 0; i < m; i++) a[i] -= '0', b[i] -= '0';
  t[0].init();
  sz = 0;
  for (i = 0; i <= n - m / 2; i++) {
    int p = 0;
    for (j = i; j < i + m / 2; j++) {
      k = s[j] - '0';
      if (!t[p].ch[k]) sz++, t[sz].init(), t[p].ch[k] = sz;
      p = t[p].ch[k];
    }
    t[p].v = 1;
  }
  queue<int> q;
  q.push(0);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    int fa = t[u].fail;
    for (i = 0; i < 10; i++) {
      int &j = t[u].ch[i];
      if (j == 0) {
        j = u == 0 ? 0 : t[fa].ch[i];
      } else {
        t[j].fail = u == 0 ? 0 : t[fa].ch[i];
        q.push(j);
      }
    }
  }
  memset(dp, -1, sizeof(dp));
  int ans = dfs(0, 0, 0, 0, 0);
  printf("%d\n", ans);
  return 0;
}
