#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 1;
const int M = 51;
const int MOD = 1e9 + 7;
const int INF = 1e7;
const double EPS = 1e-10;
template <int V>
struct AhoCorasick {
  bool end[V];
  int size, link[V], queue[V], trie[V][10];
  AhoCorasick() { init(); }
  int addNode() {
    memset(trie[size], 0, 10 * sizeof(int));
    link[size] = 0;
    end[size] = false;
    return size++;
  }
  void init() {
    size = 0;
    addNode();
  }
  void addString(const char *str, int len) {
    int state = 0;
    for (int i = 0; i < len; ++i) {
      int c = str[i];
      if (!trie[state][c]) trie[state][c] = addNode();
      state = trie[state][c];
    }
    end[state] = true;
  }
  void build() {
    queue[0] = 0;
    for (int head = 0, tail = 1; head < tail; ++head) {
      int v = queue[head];
      for (int c = 0; c < 10; ++c)
        if (trie[v][c]) {
          int u = link[v];
          while (u && !trie[u][c]) u = link[u];
          link[trie[v][c]] = (!v ? 0 : trie[u][c]);
          queue[tail++] = trie[v][c];
        } else {
          trie[v][c] = trie[link[v]][c];
        }
    }
  }
};
AhoCorasick<(N * M) / 2> ac;
int n, t, d, f[M][(N * M) >> 1][8];
char str[N], x[M], y[M];
void inc(int &xv, int yv) {
  xv += yv;
  if (xv >= MOD) xv -= MOD;
}
int main() {
  scanf(" %s %s %s", str, x, y);
  n = strlen(str), d = strlen(x);
  for (int i = 0; i < n; ++i) str[i] -= '0';
  for (int i = 0; i < d; ++i) x[i] -= '0', y[i] -= '0';
  ac.init();
  for (int i = 0; i < n - (d >> 1) + 1; ++i) {
    ac.addString(str + i, d >> 1);
  }
  ac.build();
  t = ac.size, f[0][0][3] = 1;
  for (int i = 0; i < d; ++i)
    for (int v = 0; v < t; ++v)
      for (int s = 0; s < 8; ++s)
        if (f[i][v][s]) {
          for (int p = 0; p < 10; ++p) {
            if (((s & 1) && p < x[i]) || ((s & 2) && p > y[i])) continue;
            int s2 = s & 4;
            s2 |= ((s & 1) && p == x[i] ? 1 : 0);
            s2 |= ((s & 2) && p == y[i] ? 2 : 0);
            int u = ac.trie[v][p];
            s2 |= ac.end[u] ? 4 : 0;
            inc(f[i + 1][u][s2], f[i][v][s]);
          }
        }
  int ans = 0;
  for (int v = 0; v < t; ++v)
    for (int s = 4; s < 8; ++s) {
      inc(ans, f[d][v][s]);
    }
  printf("%d", ans);
  return 0;
}
