#include <bits/stdc++.h>
const int N = 1e3 + 5;
const int A = 25000 + 5;
const int Mod = 1e9 + 7;
char s[N], tA[N], tB[N];
int n, m, len, root, cnt, to[A][10], val[A], fail[A], que[A], qn;
int g[55][A][2][2][2];
void Get_fail() {
  for (int i = 0; i < 10; ++i) to[0][i] = 1;
  fail[que[qn = 1] = 1] = 0;
  for (int ql = 1, u; u = que[ql], ql <= qn; ++ql) {
    for (int i = 0, v; i < 10; ++i)
      if (v = to[u][i])
        fail[v] = to[fail[u]][i], que[++qn] = v;
      else
        to[u][i] = to[fail[u]][i];
  }
  for (int ql = 1, u; u = que[ql], ql <= qn; ++ql) val[u] |= val[fail[u]];
}
int main() {
  scanf("%s", s + 1);
  n = std ::strlen(s + 1);
  scanf("%s", tA + 1), scanf("%s", tB + 1);
  m = std ::strlen(tA + 1), len = m >> 1;
  root = cnt = 1;
  for (int str = 1; str + len - 1 <= n; ++str) {
    int u = root;
    for (int i = 0, c; i < len; ++i) {
      c = s[str + i] - '0';
      if (!to[u][c]) to[u][c] = ++cnt;
      u = to[u][c];
    }
    val[u] = true;
  }
  Get_fail();
  g[0][1][1][1][0] = 1;
  for (int k = 1; k <= m; ++k) {
    int cA = tA[k] - '0', cB = tB[k] - '0';
    for (int u = 1; u <= cnt; ++u)
      for (int o1 = 0; o1 < 2; ++o1)
        for (int o2 = 0; o2 < 2; ++o2)
          for (int o = 0; o < 2; ++o)
            if (g[k - 1][u][o1][o2][o]) {
              for (int c = 0; c < 10; ++c) {
                if (o1 && c < cA) continue;
                if (o2 && c > cB) break;
                int v = to[u][c], o3 = (o1 && c == cA), o4 = (o2 && c == cB);
                (g[k][v][o3][o4][o | val[v]] += g[k - 1][u][o1][o2][o]) %= Mod;
              }
            }
  }
  int ans = 0;
  for (int u = 1; u <= cnt; ++u)
    for (int o1 = 0; o1 < 2; ++o1)
      for (int o2 = 0; o2 < 2; ++o2) (ans += g[m][u][o1][o2][1]) %= Mod;
  printf("%d\n", ans);
}
