#include <bits/stdc++.h>
using namespace std;
const long long P = 1e9 + 7;
const int N = 1005;
void add(long long &x, long long y) {
  x += y;
  if (x >= P) x -= P;
}
queue<int> q;
int d, e, n;
int A[N], B[N];
char s[N], a[N], b[N];
struct Aho_Corasick_Automaton {
  int c[30000][10], val[30000], fail[30000], cnt;
  void clear() {
    for (int i = 0; i <= cnt; ++i) {
      for (int j = 0; j < 10; ++j) c[i][j] = 0;
      val[i] = 0;
      fail[i] = 0;
    }
    cnt = 0;
  }
  void ins(int l, int r) {
    int now = 0;
    for (int i = l; i <= r; i++) {
      int v = s[i] - '0';
      if (!c[now][v]) c[now][v] = ++cnt;
      now = c[now][v];
    }
    val[now] = 1;
  }
  void build() {
    for (int i = 0; i < 10; i++)
      if (c[0][i]) {
        fail[c[0][i]] = 0;
        q.push(c[0][i]);
      }
    while (!q.empty()) {
      int u = q.front();
      q.pop();
      for (int i = 0; i < 10; i++) {
        if (c[u][i]) {
          fail[c[u][i]] = c[fail[u]][i];
          q.push(c[u][i]);
        } else
          c[u][i] = c[fail[u]][i];
      }
    }
    for (int i = 0; i <= cnt; ++i) {
      if (val[i] == 1) {
        for (int j = 0; j < 10; ++j) c[i][j] = i;
      }
    }
  }
} AC;
long long ans;
long long f[60][2][30000];
int main() {
  int T = 1;
  while (T--) {
    AC.clear();
    scanf("%s", s + 1);
    n = strlen(s + 1);
    scanf("%s", a + 1);
    scanf("%s", b + 1);
    d = strlen(a + 1);
    e = d / 2;
    for (int i = 1; i <= d; ++i) {
      A[i] = a[i] - '0';
      B[i] = b[i] - '0';
    }
    --A[d];
    for (int i = d; i >= 1; --i) {
      if (A[i] < 0) {
        A[i] += 10;
        A[i - 1]--;
      } else
        break;
    }
    for (int l = 1, r = e; r <= n; ++l, ++r) {
      AC.ins(l, r);
    }
    AC.build();
    for (int i = 0; i <= d; ++i)
      for (int j = 0; j < 2; ++j)
        for (int k = 0; k <= AC.cnt; ++k) f[i][j][k] = 0;
    f[0][0][0] = 1;
    int v;
    for (int i = 0; i < d; ++i) {
      for (int j = 0; j < 2; ++j) {
        for (int k = 0; k <= AC.cnt; ++k) {
          if (!f[i][j][k]) continue;
          if (j == 1) {
            for (int o = 0; o <= 9; ++o) {
              add(f[i + 1][j][AC.c[k][o]], f[i][j][k]);
            }
          } else {
            v = A[i + 1];
            for (int o = 0; o < v; ++o) {
              add(f[i + 1][1][AC.c[k][o]], f[i][j][k]);
            }
            add(f[i + 1][0][AC.c[k][v]], f[i][j][k]);
          }
        }
      }
    }
    ans = 0;
    for (int j = 0; j < 2; ++j) {
      for (int k = 0; k <= AC.cnt; ++k) {
        if (!f[d][j][k]) continue;
        if (AC.val[k]) add(ans, P - f[d][j][k]);
      }
    }
    for (int i = 0; i <= d; ++i)
      for (int j = 0; j < 2; ++j)
        for (int k = 0; k <= AC.cnt; ++k) f[i][j][k] = 0;
    f[0][0][0] = 1;
    for (int i = 0; i < d; ++i) {
      for (int j = 0; j < 2; ++j) {
        for (int k = 0; k <= AC.cnt; ++k) {
          if (!f[i][j][k]) continue;
          if (j == 1) {
            for (int o = 0; o <= 9; ++o) {
              add(f[i + 1][j][AC.c[k][o]], f[i][j][k]);
            }
          } else {
            v = B[i + 1];
            for (int o = 0; o < v; ++o) {
              add(f[i + 1][1][AC.c[k][o]], f[i][j][k]);
            }
            add(f[i + 1][0][AC.c[k][v]], f[i][j][k]);
          }
        }
      }
    }
    for (int j = 0; j < 2; ++j) {
      for (int k = 0; k <= AC.cnt; ++k) {
        if (!f[d][j][k]) continue;
        if (AC.val[k]) add(ans, f[d][j][k]);
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
