#include<iostream>
#include<cstring>#include<string>
#include<cstdio>
#include<stdio.h>
#include<algorithm>
#include<cmath>
#include<map>
#include<queue>
#include<bitset>
#include<stack>
using namespace std;
#pragma comment(linker, "/STACK:1024000000,1024000000")
#define inf 0x3f3f3f3f
#define eps 1e-9
#define pii pair<int,int>
#define MP make_pair
#define ls (i << 1)
#define rs (i<<1|1)
#define md (ll + rr >> 1)
#define LL long long
#define ULL unsigned long long
#define N ( 100 + 10 )
#define M ( 100000 + 10)
#define mod 1000000007
char s[M], x[N], y[N];
int ch[M][10], val[M];
int nxt[M];
int tot;
int dp[55][M][2][2][2];
void init() {
memset(ch[0], -1, sizeof ch[0]);
tot = 0;
}
void insert(char *s, int len) {
int u = 0;
for(int i = 0; i < len; ++i) {
int c = s[i] - '0';
if(ch[u][c] == -1) {
ch[u][c] = ++tot;
memset(ch[tot], -1, sizeof ch[tot]);
val[tot] = 0;
}
u = ch[u][c];
}
val[u] = 1;
}
void build() {
queue<int> que;
nxt[0] = 0;
for(int i = 0; i < 10; ++i) {
int &u = ch[0][i];
if(u == -1)
u = 0;
else {
que.push(u);
nxt[u] = 0;
}
}
while(!que.empty() ) {
int now = que.front();
que.pop();
for(int i = 0; i < 10; ++i) {
int &u = ch[now][i];
if(u == -1) {
u = ch[nxt[now]][i];
}
else {
nxt[u] = ch[nxt[now]][i];
que.push(u);
}
}
}
}
void add(int &u, int v) {
u += v;
if(u >= mod) u -= mod;
}
bool check(int x) {
int t[N];
int len = 0;
while(x) {
t[len++] = x % 10;
x /= 10;
}
reverse(t, t + len);
int u = 0;
bool e = 0;
for(int i = 0; i < len; ++i) {
u = ch[u][t[i]];
e |= val[u];
}
return e;
}
int gao(int d) {
int s = 0;
for(int i = 0; i < d; ++i)
s = s * 10 + x[i] - '0';
int t = 0;
for(int i = 0; i < d; ++i)
t = t * 10 + y[i] - '0';
int ans = 0;
for(int i = s; i <= t; ++i) {
if(check(i)) ++ans;
}
return ans;
}
int main() {
scanf("%s", s);
scanf("%s%s", x, y);
int d =strlen(x);
int len = strlen(s);
init();
for(int i = 0; i < len; ++i) {
for(int j = d/2; j <= d; ++j) {
if(i + j <= len)
insert(s+i, j);
}
}
build();
dp[0][0][1][1][0] = 1;
for(int i = 0; i < d; ++i) {
for(int j = 0; j <= tot; ++j) {
for(int e = 0; e < 2; ++e) {
for(int f = 0; f < 2; ++f) {
for(int g = 0; g < 2; ++g) {
if(dp[i][j][e][f][g] == 0) continue;
int st = 0, ed = 9;
if(e) ed = y[i] - '0';
if(f) st = x[i] - '0';
// printf("j %d st %d ed %d\n", j,st, ed);
for(int k = st; k <= ed; ++k) {
int jj = ch[j][k];
// printf("jj %d val %d\n", jj, val[jj]);
//printf("k %d dp[%d][%d][%d][%d][%d] : ",k, i+1, jj, e&&k ==y[i], f&&k==x[i], g|val[jj]);
add(dp[i+1][jj][e&&k==(y[i]-'0')][f&&k==(x[i]-'0')][g||val[jj]], dp[i][j][e][f][g]);
}
}
}
}
}
}
int ans = 0;
for(int j = 0; j <= tot; ++j) {
for(int e = 0; e < 2; ++e) {
for(int f = 0; f < 2; ++f) {
add(ans, dp[d][j][e][f][1]);
}
}
}
printf("%d\n", ans);
}