#include <bits/stdc++.h>
using namespace std;
int dp[51][510005][2], tot[51], pw[51];
struct tree {
  int vis[10];
  int fail, dep;
} AC[510005];
char s[1005], t[55];
int len, cnt, d, ans, res;
void build(int x) {
  int now = 0;
  for (int i = x; i <= len; i++) {
    if (!AC[now].vis[s[i] - '0']) {
      AC[now].vis[s[i] - '0'] = ++cnt;
      AC[cnt].dep = AC[now].dep + 1;
    }
    now = AC[now].vis[s[i] - '0'];
  }
}
void getfail() {
  queue<int> Q;
  for (int i = 0; i < 10; i++) {
    if (AC[0].vis[i]) Q.push(AC[0].vis[i]);
  }
  while (!Q.empty()) {
    int u = Q.front();
    Q.pop();
    for (int i = 0; i < 10; i++) {
      if (AC[u].vis[i]) {
        AC[AC[u].vis[i]].fail = AC[AC[u].fail].vis[i];
        Q.push(AC[u].vis[i]);
      } else
        AC[u].vis[i] = AC[AC[u].fail].vis[i];
    }
  }
}
void solve(int op) {
  res = 0;
  memset(dp, 0, sizeof(dp));
  dp[0][0][1] = 1;
  pw[len] = 1;
  for (int i = len - 1; i >= 1; i--) pw[i] = 10ll * pw[i + 1] % 1000000007;
  for (int i = len - 1; i >= 1; i--)
    tot[i] = (tot[i + 1] + 1ll * pw[i + 1] * (t[i + 1] - '0') % 1000000007) %
             1000000007;
  for (int i = 1; i <= len; i++) {
    for (int j = 0; j <= cnt; j++) {
      if (!dp[i - 1][j][0] && !dp[i - 1][j][1]) continue;
      for (int k = 0; k < 10; k++)
        (dp[i][AC[j].vis[k]][0] += dp[i - 1][j][0]) %= 1000000007;
      for (int k = 0; k < t[i] - '0'; k++)
        (dp[i][AC[j].vis[k]][0] += dp[i - 1][j][1]) %= 1000000007;
      (dp[i][AC[j].vis[t[i] - '0']][1] += dp[i - 1][j][1]) %= 1000000007;
    }
    for (int j = 0; j <= cnt; j++) {
      if (AC[j].dep >= d) {
        (res += 1ll * dp[i][j][0] * pw[i] % 1000000007) %= 1000000007;
        (res += 1ll * dp[i][j][1] * (tot[i] + 1) % 1000000007) %= 1000000007;
        dp[i][j][0] = dp[i][j][1] = 0;
      }
    }
  }
  (ans += 1ll * op * res % 1000000007) %= 1000000007;
}
int main() {
  scanf("%s", s + 1);
  len = strlen(s + 1);
  for (int i = 1; i <= len; i++) build(i);
  getfail();
  scanf("%s", t + 1);
  len = strlen(t + 1);
  d = len / 2;
  t[len]--;
  int now = len;
  while (t[now] < '0') t[now] += 10, t[now - 1]--, now--;
  solve(1000000007 - 1);
  scanf("%s", t + 1);
  len = strlen(t + 1);
  solve(1);
  printf("%d\n", ans);
  return 0;
}
