#include <bits/stdc++.h>
using namespace std;
struct vertex {
  map<char, int> next, go;
  int p, link;
  char pch;
  bool leaf;
  int length;
  vertex(int p = -1, char pch = -1, int length = 0)
      : p(p), pch(pch), link(-1), leaf(0), length(length) {}
};
vector<vertex> t;
void aho_init() {
  t.clear();
  t.push_back(vertex());
}
int add_string(string s, int id) {
  int v = 0;
  for (char c : s) {
    if (!t[v].next.count(c)) {
      t[v].next[c] = t.size();
      t.push_back(vertex(v, c, t[v].length + 1));
    }
    v = t[v].next[c];
  }
  t[v].leaf = 1;
  return v;
}
int go(int v, char c);
int get_link(int v) {
  if (t[v].link < 0)
    if (!v || !t[v].p)
      t[v].link = 0;
    else
      t[v].link = go(get_link(t[v].p), t[v].pch);
  return t[v].link;
}
int go(int v, char c) {
  if (!t[v].go.count(c))
    if (t[v].next.count(c))
      t[v].go[c] = t[v].next[c];
    else
      t[v].go[c] = v == 0 ? 0 : go(get_link(v), c);
  return t[v].go[c];
}
long long dp[55][50005][2][2][2];
string x, y;
int d;
const int M = 1e9 + 7;
long long solve(int i, int v, int b1, int b2, int b) {
  long long &r = dp[i][v][b1][b2][b];
  if (r != -1) return r;
  r = (i == d) && b;
  for (char c : "0123456789")
    if (i < d && c >= '0') {
      if (b1 && c < x[i]) continue;
      if (b2 && c > y[i]) continue;
      int nt = go(v, c);
      r += solve(i + 1, nt, b1 ? x[i] == c : 0, b2 ? y[i] == c : 0,
                 b || t[nt].leaf);
    }
  r %= M;
  return r;
}
int main() {
  string s;
  cin >> s;
  cin >> x >> y;
  d = ((int)x.size());
  aho_init();
  for (int i = 0; i < ((int)s.size()) - d / 2 + 1; i++) {
    add_string(s.substr(i, d / 2), i);
  }
  memset(dp, -1, sizeof(dp));
  cout << solve(0, 0, 1, 1, 0) << endl;
  return 0;
}
