#include <bits/stdc++.h>
using namespace std;
namespace zyt {
const int N = 1e3 + 10, D = 55, CH = 10, P = 1e9 + 7;
namespace Auto_AC_Machine {
int ctoi(const char c) { return c - '0'; }
struct node {
  int s[CH], fail;
  bool tag;
} tree[N * D / 2];
int cnt;
void insert(const string &s) {
  int now = 0;
  for (auto c : s) {
    int x = ctoi(c);
    if (!tree[now].s[x]) tree[now].s[x] = ++cnt;
    now = tree[now].s[x];
  }
  tree[now].tag = true;
}
void getfail() {
  queue<int> q;
  for (int i = 0; i < CH; i++)
    if (tree[0].s[i]) q.push(tree[0].s[i]), tree[tree[0].s[i]].fail = 0;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    if (tree[tree[u].fail].tag) tree[u].tag = true;
    for (int i = 0; i < CH; i++) {
      int &p = tree[u].s[i];
      if (p)
        tree[p].fail = tree[tree[u].fail].s[i], q.push(p);
      else
        p = tree[tree[u].fail].s[i];
    }
  }
}
}  // namespace Auto_AC_Machine
string s, l, r;
int n, f[D][2][N * D / 2][2];
bool vis[D][2][N * D / 2][2];
using namespace Auto_AC_Machine;
int dfs(const int pos, const bool st, const int p, const bool done) {
  if (pos == n) return tree[p].tag || done ? 1 : 0;
  if (vis[pos][st][p][done]) return f[pos][st][p][done];
  vis[pos][st][p][done] = true;
  int &ans = f[pos][st][p][done];
  ans = 0;
  for (int i = 0; i <= (st ? ctoi(s[pos]) : 9); i++)
    ans = (ans + dfs(pos + 1, st && i == ctoi(s[pos]), tree[p].s[i],
                     done || tree[p].tag)) %
          P;
  return ans;
}
int work() {
  cin >> s >> l >> r;
  n = l.size();
  for (int i = 0; i + (n >> 1) <= s.size(); i++) insert(s.substr(i, n >> 1));
  getfail();
  for (int i = l.size() - 1; i >= 0; i--)
    if (ctoi(l[i])) {
      --l[i];
      break;
    } else
      l[i] = '9';
  s = l;
  int tmp = dfs(0, true, 0, false);
  memset(vis, 0, sizeof(vis));
  s = r;
  printf("%d", (dfs(0, true, 0, false) - tmp + P) % P);
  return 0;
}
}  // namespace zyt
int main() { return zyt::work(); }
