#include <bits/stdc++.h>
using namespace std;
const int chr = 10;
struct node {
  int next[chr];
  int ed;
  node() {
    memset(next, -1, sizeof next);
    ed = 0;
  }
};
node tree[25004];
int suffix[25004], indx, len, path[25004];
string S;
long long dp[25004][55][2][2][2];
struct Aho_Corasick {
  void init() {
    len = 0;
    memset(tree, 0, sizeof tree);
    memset(suffix, 0, sizeof suffix);
    tree[0] = node();
    indx = 0;
  }
  void insert(int s, int e) {
    int now = 0;
    for (int i = s; i <= e; i++) {
      int id = (S[i] - '0');
      if (tree[now].next[id] == -1) {
        tree[now].next[id] = ++indx;
        tree[indx] = node();
      }
      now = tree[now].next[id];
    }
    tree[now].ed = 1;
  }
  void reverse_link() {
    queue<int> Q;
    for (int i = 0; i < chr; i++) {
      if (tree[0].next[i] == -1)
        tree[0].next[i] = 0;
      else
        Q.push(tree[0].next[i]);
    }
    while (!Q.empty()) {
      int u = Q.front();
      Q.pop();
      for (int i = 0; i < chr; i++) {
        int v = tree[u].next[i];
        if (v == -1) {
          tree[u].next[i] = tree[suffix[u]].next[i];
          continue;
        }
        suffix[v] = tree[suffix[u]].next[i];
        Q.push(v);
        path[len++] = v;
      }
    }
  }
};
string x, y;
int n;
long long solve(int acid, int indx, int a, int b, int f) {
  if (indx == n) return f;
  long long &ret = dp[acid][indx][a][b][f];
  if (ret != -1) return ret;
  ret = 0;
  if (f) {
    for (int i = 0; i < chr; i++) {
      int first = x[indx] - '0';
      int second = y[indx] - '0';
      if (!a && i < first) continue;
      if (!b && i > second) continue;
      ret += solve(acid, indx + 1, a | (first < i), b | (second > i), f) %
             1000000007;
      ret %= 1000000007;
    }
    return ret;
  }
  for (int i = 0; i < chr; i++) {
    int first = x[indx] - '0';
    int second = y[indx] - '0';
    if (!a && i < first) continue;
    if (!b && i > second) continue;
    int nwid = tree[acid].next[i];
    if (f)
      ret += solve(acid, indx + 1, a | (first < i), b | (second > i), f) %
             1000000007;
    else
      ret += solve(nwid, indx + 1, a | (i > first), b | (i < second),
                   tree[nwid].ed) %
             1000000007;
    ret %= 1000000007;
  }
  return ret;
}
int main() {
  Aho_Corasick AC;
  AC.init();
  cin >> S >> x >> y;
  int sz = S.length();
  n = x.length();
  int d = n / 2;
  for (int i = 0; i + d - 1 < sz; i++) AC.insert(i, i + d - 1);
  AC.reverse_link();
  memset(dp, -1, sizeof dp);
  long long get = solve(0, 0, 0, 0, 0);
  cout << get << endl;
  return 0;
}
