#include <bits/stdc++.h>
using namespace std;
string d;
int r;
vector<pair<string, int>> query;
void help(string e, int v) {
  for (int i = 0; i < e.size(); i++) {
    string q = e;
    for (int j = i + 1; j < e.size(); j++) q[j] = '?';
    for (int j = i == 0; j < e[i] - '0'; j++) {
      q[i] = j + '0';
      query.push_back(make_pair(q, v));
    }
  }
}
int V, tr[25001][10];
bool fin[25001];
int qu[25001], qs, qe, fail[25001];
int atr[25001][10];
int c[25001][51][2];
int C(int p, int l, bool f) {
  if (fin[p]) f = true;
  if (l == 0) return f;
  if (c[p][l][f] != -1) return c[p][l][f];
  c[p][l][f] = 0;
  for (int i = 0; i < 10; i++) {
    c[p][l][f] += C(atr[p][i], l - 1, f);
    if (c[p][l][f] >= 1000000007) c[p][l][f] -= 1000000007;
  }
  return c[p][l][f];
}
int main() {
  string s, e;
  char buf[1024];
  scanf("%s", buf);
  d = buf;
  scanf("%s", buf);
  s = buf;
  scanf("%s", buf);
  e = buf;
  query.push_back(make_pair(e, 1));
  help(e, 1);
  help(s, -1);
  memset(tr, -1, sizeof(tr));
  V++;
  int lim = s.size() / 2;
  for (int i = 0; i + lim - 1 < d.size(); i++) {
    int p = 0;
    for (int j = 0; j < lim; j++) {
      if (tr[p][d[i + j] - '0'] == -1) tr[p][d[i + j] - '0'] = V++;
      p = tr[p][d[i + j] - '0'];
    }
    fin[p] = true;
  }
  qu[qe++] = 0;
  fail[0] = -1;
  while (qs < qe) {
    int p = qu[qs++];
    for (int i = 0; i < 10; i++) {
      int q = tr[p][i];
      if (q != -1) {
        qu[qe++] = q;
        fail[q] = 0;
        for (int j = fail[p]; j != -1; j = fail[j]) {
          if (tr[j][i] != -1) {
            fail[q] = tr[j][i];
            if (fin[fail[q]]) fin[q] = true;
            break;
          }
        }
      }
    }
  }
  for (int i = 0; i < V; i++) {
    for (int j = 0; j < 10; j++) {
      for (int k = i; k != -1; k = fail[k]) {
        if (tr[k][j] != -1) {
          atr[i][j] = tr[k][j];
          break;
        }
      }
    }
  }
  memset(c, -1, sizeof(c));
  for (auto q : query) {
    int p = 0, l = 0;
    bool f = false;
    for (auto i : q.first) {
      if (i != '?') {
        p = atr[p][i - '0'];
        if (fin[p]) f = true;
      } else
        l++;
    }
    if (q.second == 1) {
      r += C(p, l, f);
      if (r >= 1000000007) r -= 1000000007;
    } else {
      r -= C(p, l, f);
      if (r < 0) r += 1000000007;
    }
  }
  printf("%d", r);
  return 0;
}
