Vasily has recently learned about the amazing properties of number π. In one of the articles it has been hypothesized that, whatever the sequence of numbers we have, in some position, this sequence is found among the digits of number π. Thus, if you take, for example, the epic novel "War and Peace" of famous Russian author Leo Tolstoy, and encode it with numbers, then we will find the novel among the characters of number π.

Vasily was absolutely delighted with this, because it means that all the books, songs and programs have already been written and encoded in the digits of π. Vasily is, of course, a bit wary that this is only a hypothesis and it hasn't been proved, so he decided to check it out.

To do this, Vasily downloaded from the Internet the archive with the sequence of digits of number π, starting with a certain position, and began to check the different strings of digits on the presence in the downloaded archive. Vasily quickly found short strings of digits, but each time he took a longer string, it turned out that it is not in the archive. Vasily came up with a definition that a string of length d is a half-occurrence if it contains a substring of length of at least <image>, which occurs in the archive.

To complete the investigation, Vasily took 2 large numbers x, y (x ≤ y) with the same number of digits and now he wants to find the number of numbers in the interval from x to y, which are half-occurrences in the archive. Help Vasily calculate this value modulo 109 + 7.

Input

The first line contains string s consisting of decimal digits (1 ≤ |s| ≤ 1000) that Vasily will use to search substrings in. According to hypothesis, this sequence of digis indeed occurs in the decimal representation of π, although we can't guarantee that.

The second and third lines contain two positive integers x, y of the same length d (x ≤ y, 2 ≤ d ≤ 50). Numbers x, y do not contain leading zeroes.

Output

Print how many numbers in the segment from x to y that are half-occurrences in s modulo 109 + 7.

Examples

Input

02
10
19


Output

2


Input

023456789
10
19


Output

9


Input

31415926535
10
29


Output

20
#include <bits/stdc++.h>
const int N = 1e3 + 2, M = 2.5e4 + 2, K = 52, p = 1e9 + 7;
int dp[K][M][2][2], c[M][10], f[M], dl[M], s[N], s1[K], s2[K];
int n, m, i, j, k, tou = 1, wei, cc, d, ds, x;
bool ed[M];
inline void add(int &x, int y) {
  if ((x = x + y) >= p) x -= p;
}
int sol(int a[], int typ) {
  int ans = 0;
  memset(dp, 0, sizeof(dp));
  dp[0][0][1][0] = 1;
  for (i = 0; i < d; i++)
    for (j = 0; j <= ds; j++) {
      for (k = 0; k <= 9; k++) {
        add(dp[i + 1][c[j][k]][0][1], dp[i][j][0][1]);
        if (ed[c[j][k]])
          add(dp[i + 1][c[j][k]][0][1], dp[i][j][0][0]);
        else
          add(dp[i + 1][c[j][k]][0][0], dp[i][j][0][0]);
      }
      for (k = 0; k < a[i + 1]; k++) {
        add(dp[i + 1][c[j][k]][0][1], dp[i][j][1][1]);
        if (ed[c[j][k]])
          add(dp[i + 1][c[j][k]][0][1], dp[i][j][1][0]);
        else
          add(dp[i + 1][c[j][k]][0][0], dp[i][j][1][0]);
      }
      k = a[i + 1];
      add(dp[i + 1][c[j][k]][1][1], dp[i][j][1][1]);
      if (ed[c[j][k]])
        add(dp[i + 1][c[j][k]][1][1], dp[i][j][1][0]);
      else
        add(dp[i + 1][c[j][k]][1][0], dp[i][j][1][0]);
    }
  for (i = 0; i <= ds; i++) add(ans, dp[d][i][0][1]);
  if (typ)
    for (i = 0; i <= ds; i++) add(ans, dp[d][i][1][1]);
  return ans;
}
int main() {
  cc = getchar();
  while ((cc < 48) || (cc > 57)) cc = getchar();
  while ((cc >= 48) && (cc <= 57)) {
    s[++n] = cc ^ 48;
    cc = getchar();
  }
  cc = getchar();
  while ((cc < 48) || (cc > 57)) cc = getchar();
  while ((cc >= 48) && (cc <= 57)) {
    s1[++d] = cc ^ 48;
    cc = getchar();
  }
  cc = getchar();
  while ((cc < 48) || (cc > 57)) cc = getchar();
  s2[1] = cc ^ 48;
  m = d >> 1;
  n = n - m + 1;
  for (i = 2; i <= d; i++) s2[i] = getchar() ^ 48;
  for (i = 1; i <= n; ed[x] = 1, i++)
    for (x = j = 0; j < m; j++)
      if (c[x][s[i + j]])
        x = c[x][s[i + j]];
      else
        x = c[x][s[i + j]] = ++ds;
  for (i = 0; i <= 9; i++)
    if (c[0][i]) dl[++wei] = c[0][i];
  while (tou <= wei)
    for (x = dl[tou++], i = 0; i <= 9; i++)
      if (c[x][i])
        f[dl[++wei] = c[x][i]] = c[f[x]][i];
      else
        c[x][i] = c[f[x]][i];
  printf("%d", (sol(s2, 1) - sol(s1, 0) + p) % p);
}
