#include <bits/stdc++.h>
using namespace std;
const int N = 100001;
const int MOD = 1e9 + 7;
struct Node {
  int next[10], go[10];
  int link;
  int pc, parent;
  bool leaf;
  Node() {
    for (int i = 0; i < 10; ++i) next[i] = go[i] = -1;
    link = -1;
    leaf = false;
  }
};
string s;
int n, d;
vector<Node> t;
string x, y;
int dp[N][51][2][2];
void add(int& x, int y) {
  x += y;
  if (x >= MOD) x -= MOD;
}
void addString(const string& s) {
  int v = 0;
  for (int i = 0; i < s.size(); ++i) {
    int c = s[i] - '0';
    if (t[v].next[c] == -1) {
      t.push_back(Node());
      int sz = t.size() - 1;
      t[v].next[c] = sz;
      t[sz].parent = v;
      t[sz].pc = c;
    }
    v = t[v].next[c];
  }
  t[v].leaf = true;
}
int go(int v, int c);
int getLink(int v) {
  if (t[v].link == -1) {
    if (v == 0 || t[v].parent == 0)
      t[v].link = 0;
    else
      t[v].link = go(getLink(t[v].parent), t[v].pc);
  }
  return t[v].link;
}
int go(int v, int c) {
  if (t[v].go[c] == -1) {
    if (t[v].next[c] != -1)
      t[v].go[c] = t[v].next[c];
    else
      t[v].go[c] = (v == 0 ? 0 : go(getLink(v), c));
  }
  return t[v].go[c];
}
void init(int v) {
  t[v].link = getLink(v);
  for (int i = 0; i < 10; ++i) t[v].go[i] = go(v, i);
  for (int i = 0; i < 10; ++i) {
    if (t[v].next[i] != -1) init(t[v].next[i]);
  }
}
int solve(int v, int len, int f1, int f2, const string& s) {
  if (dp[v][len][f1][f2] != -1) return dp[v][len][f1][f2];
  if (len == d) {
    if (f2 == 0)
      dp[v][len][f1][f2] = 0;
    else
      dp[v][len][f1][f2] = 1;
    return dp[v][len][f1][f2];
  }
  int last = 9;
  if (f1 == 1) last = s[len] - '0';
  dp[v][len][f1][f2] = 0;
  for (int i = 0; i <= last; ++i) {
    int nextf1 = 0, nextf2 = f2;
    if (f1 == 1 && i == last) nextf1 = 1;
    if (t[t[v].go[i]].leaf == true) nextf2 |= 1;
    add(dp[v][len][f1][f2], solve(t[v].go[i], len + 1, nextf1, nextf2, s));
  }
  return dp[v][len][f1][f2];
}
int main() {
  cin >> s >> x >> y;
  d = x.size();
  t.push_back(Node());
  for (int i = 0; i <= (int)s.size() - d / 2; ++i)
    addString(s.substr(i, d / 2));
  init(0);
  memset(dp, -1, sizeof(dp));
  int ans = solve(0, 0, 1, 0, y);
  memset(dp, -1, sizeof(dp));
  ans -= solve(0, 0, 1, 0, x);
  if (ans < 0) ans += MOD;
  bool c = false;
  for (int i = 0; i <= (int)x.size() - d / 2; ++i) {
    string w = x.substr(i, d / 2);
    for (int j = 0; j <= (int)s.size() - d / 2; ++j) {
      if (s.substr(j, d / 2) == w) c = true;
    }
  }
  if (c == true) add(ans, 1);
  cout << ans << endl;
  return 0;
}
