#include <bits/stdc++.h>
using namespace std;
struct node {
  int ch[10];
  int f;
  int num;
};
node nn[131072];
int num = 0;
void add(int now, char* s, int d) {
  if (d == 0) {
    nn[now].num++;
    return;
  }
  if (!nn[now].ch[s[0] - '0']) {
    num++;
    nn[now].ch[s[0] - '0'] = num;
  }
  add(nn[now].ch[s[0] - '0'], s + 1, d - 1);
}
queue<int> q;
void build() {
  for (int i = 0; i < 10; i++) {
    int u = nn[0].ch[i];
    if (u) {
      nn[u].f = 0;
      q.push(u);
    }
  }
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = 0; i < 10; i++) {
      int& v = nn[u].ch[i];
      if (v) {
        nn[v].f = nn[nn[u].f].ch[i];
        q.push(v);
      } else {
        v = nn[nn[u].f].ch[i];
      }
    }
  }
}
int d;
int dp[131072], dp2[131072];
int query(char* x, int tp) {
  int ans = 0;
  for (int i = 0; i < d; i++) {
    ans = ((long long)ans * 10 + x[i] - '0') % 1000000007;
  }
  ans += tp;
  if (ans >= 1000000007) {
    ans -= 1000000007;
  }
  for (int i = 0; i <= num; i++) {
    dp[i] = 0;
  }
  int now = 0;
  for (int wz = 0; wz < d; wz++) {
    for (int i = 0; i <= num; i++) {
      dp2[i] = dp[i];
      dp[i] = 0;
    }
    for (int i = 0; i <= num; i++) {
      if (nn[i].num) {
        continue;
      }
      for (int j = 0; j < 10; j++) {
        dp[nn[i].ch[j]] += dp2[i];
        if (dp[nn[i].ch[j]] >= 1000000007) {
          dp[nn[i].ch[j]] -= 1000000007;
        }
      }
    }
    if (nn[now].num) {
      continue;
    }
    for (int i = 0; i < x[wz] - '0'; i++) {
      dp[nn[now].ch[i]]++;
      if (dp[nn[now].ch[i]] >= 1000000007) {
        dp[nn[now].ch[i]] -= 1000000007;
      }
    }
    now = nn[now].ch[x[wz] - '0'];
  }
  dp[now] += tp;
  if (dp[now] >= 1000000007) {
    dp[now] -= 1000000007;
  }
  for (int i = 0; i <= num; i++) {
    if (nn[i].num) {
      continue;
    }
    ans -= dp[i];
    if (ans < 0) {
      ans += 1000000007;
    }
  }
  return ans;
}
char x[64], y[64];
char s[1024];
int main() {
  scanf("%s%s%s", s, x, y);
  int n = strlen(s);
  d = strlen(y);
  for (int i = 0; i <= n - d / 2; i++) {
    add(0, s + i, d / 2);
  }
  build();
  int ans = query(y, 1) - query(x, 0);
  if (ans < 0) {
    ans += 1000000007;
  }
  printf("%d\n", ans);
  return 0;
}
