#include <bits/stdc++.h>
using namespace std;
struct Tree {
  int ch[10];
  int len;
  int fail;
} T[100010];
int tot;
void insert(char* str, int len) {
  int now = 0;
  for (int i = 0; i < len; i++) {
    if (!T[now].ch[str[i] - '0']) {
      T[now].ch[str[i] - '0'] = ++tot;
      T[tot].len = i + 1;
    }
    now = T[now].ch[str[i] - '0'];
  }
  return;
}
queue<int> q;
void bfs() {
  for (int i = 0; i < 10; i++)
    if (T[0].ch[i]) {
      q.push(T[0].ch[i]);
      T[T[0].ch[i]].fail = 0;
    }
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = 0; i < 10; i++)
      if (T[u].ch[i]) {
        T[T[u].ch[i]].fail = T[T[u].fail].ch[i];
        q.push(T[u].ch[i]);
      } else
        T[u].ch[i] = T[T[u].fail].ch[i];
  }
  return;
}
int d, D;
int dp[61][60010][2][2];
void add(int& x, int y) {
  x += y;
  if (x >= 1000000007) x -= 1000000007;
  return;
}
int solve(int* a) {
  memset(dp, 0, sizeof(dp));
  dp[d][0][0][0] = 1;
  for (int i = d; i >= 1; i--)
    for (int j = 0; j <= tot; j++)
      for (int k = 0; k < 2; k++) {
        for (int l = 0; l <= a[i]; l++) {
          int v = T[j].ch[l];
          int tk = k || (T[v].len >= D);
          int o = (l < a[i]);
          add(dp[i - 1][v][tk][o], dp[i][j][k][0]);
        }
        for (int l = 0; l <= 9; l++) {
          int v = T[j].ch[l];
          int tk = k || (T[v].len >= D);
          add(dp[i - 1][v][tk][1], dp[i][j][k][1]);
        }
      }
  int ans = 0;
  for (int i = 0; i <= tot; i++) {
    add(ans, dp[0][i][1][0]);
    add(ans, dp[0][i][1][1]);
  }
  return ans;
}
char x[61], y[61], str[1010];
int tmp[61];
int main() {
  scanf("%s", str);
  scanf("%s", x + 1);
  scanf("%s", y + 1);
  int len = strlen(str);
  d = strlen(x + 1);
  D = d / 2;
  for (int i = 0; i + D <= len; i++) insert(str + i, D);
  bfs();
  for (int i = 1; i <= d; i++) tmp[i] = x[d - i + 1] - '0';
  tmp[1]--;
  for (int i = 1; i <= d; i++)
    if (tmp[i] < 0) {
      tmp[i + 1]--;
      tmp[i] += 10;
    }
  int ans1 = solve(tmp);
  for (int i = 1; i <= d; i++) tmp[i] = y[d - i + 1] - '0';
  int ans2 = solve(tmp);
  printf("%d\n", (ans2 - ans1 + 1000000007) % 1000000007);
  return 0;
}
