#include <bits/stdc++.h>
using namespace std;
int f[2][2][50005], m, n, nex[50005], tot, c[50005][11], num[50005];
char s[1005], a[1005], b[1005];
int solve(char s[]) {
  memset(f, 0, sizeof(f));
  int ans = 0, nex = 0;
  f[0][1][0] = 1;
  for (int i = 1; i <= m; i++) {
    memset(f[nex ^ 1], 0, sizeof(f[nex ^ 1]));
    for (int t = 0; t <= 9; t++) {
      if (i == 1 && t == 0) continue;
      for (int j = 0; j <= tot; j++) {
        int nx = c[j][t];
        if (t < s[i] - '0') {
          f[nex ^ 1][0][nx] =
              (f[nex ^ 1][0][nx] + f[nex][0][j] >= 1000000007
                   ? f[nex ^ 1][0][nx] + f[nex][0][j] - 1000000007
                   : f[nex ^ 1][0][nx] + f[nex][0][j]);
          f[nex ^ 1][0][nx] =
              (f[nex ^ 1][0][nx] + f[nex][1][j] >= 1000000007
                   ? f[nex ^ 1][0][nx] + f[nex][1][j] - 1000000007
                   : f[nex ^ 1][0][nx] + f[nex][1][j]);
        } else if (t == s[i] - '0') {
          f[nex ^ 1][1][nx] =
              (f[nex ^ 1][1][nx] + f[nex][1][j] >= 1000000007
                   ? f[nex ^ 1][1][nx] + f[nex][1][j] - 1000000007
                   : f[nex ^ 1][1][nx] + f[nex][1][j]);
          f[nex ^ 1][0][nx] =
              (f[nex ^ 1][0][nx] + f[nex][0][j] >= 1000000007
                   ? f[nex ^ 1][0][nx] + f[nex][0][j] - 1000000007
                   : f[nex ^ 1][0][nx] + f[nex][0][j]);
        } else {
          f[nex ^ 1][0][nx] =
              (f[nex ^ 1][0][nx] + f[nex][0][j] >= 1000000007
                   ? f[nex ^ 1][0][nx] + f[nex][0][j] - 1000000007
                   : f[nex ^ 1][0][nx] + f[nex][0][j]);
        }
      }
    }
    nex ^= 1;
  }
  for (int i = 1; i <= tot; i++) {
    if (num[i])
      ans = (ans + f[nex][0][i] + f[nex][1][i] >= 1000000007
                 ? ans + f[nex][0][i] + f[nex][1][i] - 1000000007
                 : ans + f[nex][0][i] + f[nex][1][i]);
  }
  return ans;
}
void get_fail() {
  queue<int> q;
  for (int i = 0; i <= 9; i++) {
    if (c[0][i]) {
      q.push(c[0][i]);
    }
  }
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    for (int i = 0; i <= 9; i++) {
      if (c[x][i]) {
        nex[c[x][i]] = c[nex[x]][i];
        q.push(c[x][i]);
      } else
        c[x][i] = c[nex[x]][i];
    }
  }
  for (int i = 0; i <= tot; i++) {
    if (num[i]) {
      for (int t = 0; t <= 9; t++) c[i][t] = i;
    }
  }
}
int main() {
  scanf("%s", s + 1);
  scanf("%s", a + 1);
  scanf("%s", b + 1);
  n = strlen(s + 1);
  m = strlen(a + 1);
  for (int i = 1; i <= n; i++) {
    int now = 0;
    for (int t = i; t <= n; t++) {
      if (!c[now][s[t] - '0']) {
        c[now][s[t] - '0'] = ++tot;
      }
      now = c[now][s[t] - '0'];
      if (t - i + 1 >= m / 2) {
        num[now] = 1;
        break;
      }
    }
  }
  get_fail();
  int now = m;
  while (a[now] == '0') a[now] = '9', now--;
  a[now]--;
  printf("%d", (solve(b) - solve(a) + 1000000007) % 1000000007);
}
