#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int kcz=1000000007;
const int maxn=60005;
const int maxd=55;
struct node
{
    int ne[26],pre,sz;
    inline node() { memset(ne,-1,sizeof(ne)); pre=0; sz=0; }
}ch[maxn];
int tot;
inline void add(char *str)
{
    int i;
    for(i=0;*str;i=ch[i].ne[*str-'0'],str++)
        if(ch[i].ne[*str-'0']==-1)
            ch[i].ne[*str-'0']=++tot;
    ch[i].sz++;
}
inline void ac()
{
    int i,j,k;
    queue<int> que;
    while(!que.empty()) que.pop();
    que.push(0); ch[0].pre=-1;
    while(!que.empty())
    {
        i=que.front(),que.pop();
        for(j=0;j<26;j++)
            if(ch[i].ne[j]!=-1)
            {
                for(k=ch[i].pre;k!=-1;)
                    if(ch[k].ne[j]!=-1)
                        break;
                    else k=ch[k].pre;
                if(k==-1) ch[ch[i].ne[j]].pre=0;
                else ch[ch[i].ne[j]].pre=ch[k].ne[j];
                que.push(ch[i].ne[j]);
            }
    }
}
char temp[maxn],l[maxn],r[maxn];
int n;
ll f[maxd][maxn],g[maxd][maxn];
inline int next_(int cur,char c)
{
    if(ch[cur].sz) return cur;
    while(cur!=-1 && ch[cur].ne[c-'0']==-1)
        cur=ch[cur].pre;
    if(cur==-1) cur=0;
    else cur=ch[cur].ne[c-'0'];
    return cur;
}
inline int check(char *s)
{
    int i,cur=0;
    for(i=0;s[i];i++)
    {
        cur=next_(cur,s[i]);
        if(ch[cur].sz) return 1;
    }
    return 0;
}
inline ll solve(char *s)
{
    int k,m,_,cur=0; m=strlen(s);
    ll res=0;
//    for(i=1;i<m;i++)
//        (res+=g[i][0])%=kcz;
    for(_=0;_<m;_++)
    {
#define g f
//        memset(g,0,sizeof(g));
//        g[0][cur]=1;
//        for(i=1;i<=m-_;i++)
//            for(j=0;j<=tot;j++)
//                for(k=(!_ && i==1)?'1':'0';k<=((i==1)?s[_]-1:'9');k++)
//                    if(!ch[j].sz)
//                        (g[i][next_(j,k)]+=g[i-1][j])%=kcz;
//                    else (g[i][j]+=g[i-1][j])%=kcz;
//        for(i=0;i<=tot;i++)
//            if(ch[i].sz)
//                (res+=g[m-_][i])%=kcz;
#undef g
        for(k=(!_)?'1':'0';k<s[_];k++)
            (res+=g[m-_-1][next_(cur,k)])%=kcz;
        cur=next_(cur,s[_]);
    }
    if(ch[cur].sz) (res+=1)%=kcz;
    return res;
}
int main()
{
    int i,j,k;
    scanf("%s%s%s",temp,l,r),n=strlen(l),k=strlen(temp);
    for(tot=0,i=k-n/2;i>=0;i--) temp[i+n/2]='\0',add(temp+i);
    ac();
//    for(i=0;i<tot;i++) g[1][i]=0;
    memset(g,0,sizeof(g));
//    for(i='1';i<='9';i++) g[1][next_(0,i)]++;
    for(i=1;i<=tot;i++)
        if(ch[i].sz)
            g[0][i]=1;
//    n=max(strlen(l),strlen(r));
//    for(i=2;i<=n;i++)
//        for(j=0;j<=tot;j++)
//            if(!ch[j].sz)
//                for(k='0';k<='9';k++)
//                    (g[i][next_(j,k)]+=g[i-1][j])%=kcz;
//            else (g[i][j]+=g[i-1][j])%=kcz;
    for(i=1;i<=n;i++)
        for(j=0;j<=tot;j++)
            for(k='0';k<='9';k++)
                (g[i][j]+=g[i-1][next_(j,k)])%=kcz;
//    for(i=1;i<=n;i++)
//        for(g[i][0]=0,j=1;j<=tot;j++)
//            if(ch[j].sz)
//                (g[i][0]+=g[i][j])%=kcz;
    printf("%lld\n",(solve(r)-solve(l)+check(l)+kcz)%kcz);
    return 0;
}


// Problem: CF585F Digits of Number Pi
// Contest: Luogu
// URL: https://www.luogu.com.cn/problem/CF585F
// Memory Limit: 250 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tune=native")
//
//#include <immintrin.h>
//#include <emmintrin.h>

#include <bits/stdc++.h>
//#pragma GCC optimize("O2")
#define vi vector<int>
#define pii pair<int, int >
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define LL long long
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=n;i>=a;i--)
#define all(x) (x).begin(), (x).end()
#define all2(x,n) (x+1), (x+1+n)
#define sz(x) ((int)(x).size())
#define mod(x) ((x)%MOD)
#define debug(x) cerr<<#x<<" : "<<x<<endl
#define mt make_tuple
#define eb emplace_back
#define o(X) (1<<(X))
#define oL(X) (1LL<<(X))
#define contain(S,X) (((S)&o(X))!=0)
#define containL(S,X) (((S)&oL(X))!=0)
#define ppt(x) __builtin_popcount(x)
using namespace std;
const int INF=0x3f3f3f3f,N=1e6+5,MOD=1e9+7;
const LL INF_LL=0x3f3f3f3f3f3f3f3fLL;
inline int getplc(int x,int y) { return (x>>y)&1; }
template<typename T>
T square(T x) {return x*x;}
LL qpow(LL a,LL b=MOD-2,LL _MOD=MOD){
	LL res=1;
	for(;b;b>>=1,a=a*a%_MOD){
		if(b&1)res=res*a%_MOD;
	}
	return res;
}
// Smax
//int Smax() { return -INF; }
template <typename T>
T Smax(T x) { return x; }
template<typename T, typename... Args>
T Smax(T a, Args... args) { return max(a, Smax(args...)); }
// Smin
template <typename T>
T Smin(T x) { return x; }
template<typename T, typename... Args>
T Smin(T a, Args... args) { return min(a, Smin(args...)); }
template <typename T>
// erro
#define errorl(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); errl(_it, args); }

void errl(istream_iterator<string> it) {}
template<typename T, typename... Args>
void errl(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	errl(++it, args...);
}

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cerr<<endl;}
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << "=" << a << " # ";
	err(++it, args...);
}
void Solve();
int main() {
#ifndef ONLINE_JUDGE
//	freopen("in.txt","r",stdin);
//    freopen("o1.txt","w",stdout);
#endif
	ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
	Solve();
	return 0;
}

//////////////////////////////////////////////////////////////////

template<const int &MOD>
struct _m_int {
	int val;

	_m_int(int64_t v = 0) {
		if (v < 0) v = v % MOD + MOD;
		if (v >= MOD) v %= MOD;
		val = int(v);
	}

	static int inv_mod(int a, int m = MOD) {
		// https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm#Example
		int g = m, r = a, x = 0, y = 1;

		while (r != 0) {
			int q = g / r;
			g %= r; swap(g, r);
			x -= q * y; swap(x, y);
		}

		return x < 0 ? x + m : x;
	}

	explicit operator int() const { return val; }
	explicit operator int64_t() const { return val; }

	_m_int& operator+=(const _m_int &other) {
		val -= MOD - other.val;
		if (val < 0) val += MOD;
		return *this;
	}

	_m_int& operator-=(const _m_int &other) {
		val -= other.val;
		if (val < 0) val += MOD;
		return *this;
	}

	static unsigned fast_mod(uint64_t x, unsigned m = MOD) {
#if !defined(_WIN32) || defined(_WIN64)
		return unsigned(x % m);
#endif
		// Optimized mod for Codeforces 32-bit machines.
		// x must be less than 2^32 * m for this to work, so that x / m fits in an unsigned 32-bit int.
		unsigned x_high = unsigned(x >> 32), x_low = unsigned(x);
		unsigned quot, rem;
		asm("divl %4\n"
		: "=a" (quot), "=d" (rem)
		: "d" (x_high), "a" (x_low), "r" (m));
		return rem;
	}

	_m_int& operator*=(const _m_int &other) {
		val = fast_mod(uint64_t(val) * other.val);
		return *this;
	}

	_m_int& operator/=(const _m_int &other) {
		return *this *= other.inv();
	}

	friend _m_int operator+(const _m_int &a, const _m_int &b) { return _m_int(a) += b; }
	friend _m_int operator-(const _m_int &a, const _m_int &b) { return _m_int(a) -= b; }
	friend _m_int operator*(const _m_int &a, const _m_int &b) { return _m_int(a) *= b; }
	friend _m_int operator/(const _m_int &a, const _m_int &b) { return _m_int(a) /= b; }

	_m_int& operator++() {
		val = val == MOD - 1 ? 0 : val + 1;
		return *this;
	}

	_m_int& operator--() {
		val = val == 0 ? MOD - 1 : val - 1;
		return *this;
	}

	_m_int operator++(int) { _m_int before = *this; ++*this; return before; }
	_m_int operator--(int) { _m_int before = *this; --*this; return before; }

	_m_int operator-() const {
		return val == 0 ? 0 : MOD - val;
	}

	bool operator==(const _m_int &other) const { return val == other.val; }
	bool operator!=(const _m_int &other) const { return val != other.val; }

	_m_int inv() const {
		return inv_mod(val);
	}

	_m_int pow(int64_t p) const {
		if (p < 0)
			return inv().pow(-p);

		_m_int a = *this, result = 1;

		while (p > 0) {
			if (p & 1)
				result *= a;

			p >>= 1;

			if (p > 0)
				a *= a;
		}

		return result;
	}

	friend ostream& operator<<(ostream &os, const _m_int &m) {
		return os << m.val;
	}
};

extern const int _MOD = 1e9+7;
using mint = _m_int<_MOD>;

struct state{
  int len,link;
  int next[12];
};
const int MAX_LEN=2*4e3+5;
state st[MAX_LEN];
int sz,last;
void sam_init(){
  st[0].len=0;
  st[0].link=-1;
  sz++;
  last=0;
}
int cnt[MAX_LEN];
void sam_extend(int c){
  int cur=sz++;
  cnt[cur]++;
  st[cur].len=st[last].len+1;
  int p=last;
  while(p!=-1&&!st[p].next[c]){
    st[p].next[c]=cur;
    p=st[p].link;
  }
  if(p==-1) st[cur].link=0;
  else{
    int q=st[p].next[c];
    if(st[p].len+1==st[q].len) st[cur].link=q;
    else{
      int clone=sz++;
      st[clone]=st[q];
      st[clone].len=st[p].len+1;
      while(p!=-1&&st[p].next[c]==q){
        st[p].next[c]=clone;
        p=st[p].link;
      }
      st[q].link=st[cur].link=clone;
    }
  }
  last=cur;
}

int n,d,leng;
char s[N],a[N],b[N];

mint f[55][3005][55][2][2];
int vis[55][3005][55][2][2];
mint solve(char *s,int x,int cur,int len,int lim,int flag){
  if(x>leng)return mint(flag);
  if(vis[x][cur][len][lim][flag])return f[x][cur][len][lim][flag];
  int up=lim?s[x]-'0':9;
  mint ans;
  rep(i,0,up){
    if(flag)ans+=solve(s,x+1,cur,len,lim&(i==up),flag);
    else{
      int p=cur;
      if(st[p].next[i])
        ans+=solve(s,x+1,st[p].next[i],len+1,lim&(i==up),
          len+1>=d/2);
      else{
        while(~p&&!st[p].next[i])p=st[p].link;
        if(~p)
          ans+=solve(s,x+1,st[p].next[i],st[p].len+1,lim&(i==up),
            st[p].len+1>=d/2);
        else
          ans+=solve(s,x+1,0,0,lim&(i==up),0);
      }
    }
  }
  f[x][cur][len][lim][flag]=ans;
  vis[x][cur][len][lim][flag]=1;
  return ans;
}

mint work(char *s){
  leng=strlen(s+1);
  rep(i1,0,51)
  rep(i2,0,3002)
  rep(i3,0,51)
  rep(i4,0,1)
  rep(i5,0,1)
  vis[i1][i2][i3][i4][i5]=0;
  return solve(s,1,0,0,1,0);
}

void Solve(){
  cin>>s+1>>a+1>>b+1;
  n=strlen(s+1),d=strlen(a+1);
  a[d]--;
  per(i,1,d)if(a[i]=='0'+-1)a[i-1]--,a[i]='9';else break;
  sam_init();
  rep(i,1,n)sam_extend(s[i]-'0');
  mint ans=work(b)-work(a);
  cout<<ans<<endl;
}


#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <string>
#include <queue>
using namespace std;
typedef long long LL;
const LL N = 200005;
const LL M = 1000000007;

LL n,d;
string s,t1,t2,t;

LL rt = 1,tot = 1,ch[15][N],ed[N],fail[N];
void insert(string x){
	LL len = x.length(),now = rt;
	for(LL i = 0;i < len;i ++){
		if(!ch[x[i] - '0'][now]) ch[x[i] - '0'][now] = ++ tot;
		now = ch[x[i] - '0'][now];
	} ed[now] = 1;
}

queue <LL> q;
void build(){
	while(!q.empty()) q.pop();
	for(LL i = 0;i < 10;i ++){
		if(ch[i][rt]){ fail[ch[i][rt]] = rt; q.push(ch[i][rt]); }
		else ch[i][rt] = rt;
	}
	while(!q.empty()){
		LL u = q.front(); q.pop();
		for(LL i = 0;i < 10;i ++){
			if(ch[i][u]){ fail[ch[i][u]] = ch[i][fail[u]]; q.push(ch[i][u]); }
			else ch[i][u] = ch[i][fail[u]];
		}
	}
}

void prep(){
	for(LL i = 1;i <= n;i ++){
		if(i + d / 2 - 1 > n) break;
		t = "";
		for(LL j = 1;j <= d / 2;j ++) t += s[i + j - 1];
		insert(t);
	}
	build();
}

string minusone(string x){
	x[d - 1] --;
	for(LL i = d - 1;i >= 0;i --){
		if(x[i] < '0'){ x[i] = '9'; x[i - 1] --; }
	} return x;
}

LL g[2][55],dp[2][55][N];
LL calc(string x){
	memset(g,0,sizeof(g));
	memset(dp,0,sizeof(dp)); dp[1][0][1] = 1;
	g[0][d] = 1; g[1][d] = 1;
	for(LL i = d - 1;i >= 1;i --){
		g[0][i] = (g[0][i + 1] * 10) % M;
		g[1][i] = (g[1][i + 1] + (x[i + 1] - '0') * g[0][i + 1]) % M;
	}
	for(LL i = 0;i < d;i ++){
		for(LL j = 1;j <= tot;j ++){
			if(ed[j]) continue;
			for(LL k = 0;k < 10;k ++){
				LL to = ch[k][j];
				dp[0][i + 1][to] = (dp[0][i + 1][to] + dp[0][i][j]) % M;
				if(k < x[i + 1] - '0') dp[0][i + 1][to] = (dp[0][i + 1][to] + dp[1][i][j]) % M;
				if(k == x[i + 1] - '0') dp[1][i + 1][to] = (dp[1][i + 1][to] + dp[1][i][j]) % M;
			}
		}
	}
	LL ret = 0;
	for(LL i = 1;i <= d;i ++){
		for(LL j = 1;j <= tot;j ++){
			if(ed[j]) ret = (ret + dp[0][i][j] * g[0][i] + dp[1][i][j] * g[1][i]) % M;
		}
	} return ret;
}

int main(){
	ios::sync_with_stdio(false);
	cin >> s; n = s.length(); s = ' ' + s;
	cin >> t1 >> t2; d = t1.length();
	t1 = minusone(t1);
	t1 = ' ' + t1; t2 = ' ' + t2;
	prep();
	cout << (calc(t2) - calc(t1) + M) % M << '\n';
	return 0;
}


#include <cstdio>
#include <cstring>
#include <algorithm>

typedef long long LL;
const int Mod = 1000000007;
const int ML = 1005, MZ = 55, MN = 50005, Sig = 10;

char s[ML], a[MZ], b[MZ]; int len, d;

int ch[MN][Sig], key[MN], fail[MN], cnt;
void BuildAC() {
	static int que[MN], l, r;
	fail[0] = -1, que[l = r = 1] = 0;
	while (l <= r) {
		int u = que[l++];
		for (int j = 0; j < Sig; ++j) {
			int v = u ? ch[fail[u]][j] : 0;
			if (ch[u][j]) fail[ch[u][j]] = v, que[++r] = ch[u][j];
			else ch[u][j] = v;
		}
	}
}

LL DP(char *V) {
	static int A[MZ];
	for (int i = 1; i <= d; ++i) A[i] = V[d - i + 1] - '0';
	static int f[MN], g[MN];
	LL S = 0;
	for (int u = 0; u <= cnt; ++u) f[u] = 0;
	int now = 0, o = 1;
	for (int i = d; i >= 1; --i) {
		for (int u = 0; u <= cnt; ++u) g[u] = 0;
		for (int u = 0; u <= cnt; ++u)
			for (int j = 0; j < Sig; ++j)
				if (!key[ch[u][j]]) (g[ch[u][j]] += f[u]) %= Mod;
		for (int j = 0; j < A[i]; ++j)
			if (!key[ch[now][j]]) g[ch[now][j]] += o;
		now = ch[now][A[i]];
		o &= key[now] ^ 1;
		S = (S * 10ll + A[i]) % Mod;
		std::swap(f, g);
	}
	for (int u = 0; u <= cnt; ++u) S -= f[u];
	return ((S - o) % Mod + Mod) % Mod;
}

int main() {
	scanf("%s%s%s", s + 1, a + 1, b + 1), len = strlen(s + 1), d = strlen(b + 1);
	for (int i = 1; i <= len - d / 2 + 1; ++i) {
		int now = 0;
		for (int j = 0; j < d / 2; ++j) {
			int c = s[i + j] - '0';
			if (!ch[now][c]) ch[now][c] = ++cnt;
			now = ch[now][c];
		} key[now] = 1;
	}
	BuildAC();
	int pos = d;
	while (a[pos] == '0') --pos; --a[pos];
	for (int i = d; i > pos; --i) a[i] = '9';
	printf("%lld\n", (DP(b) - DP(a) + Mod) % Mod);
	return 0;
}

// Luogu : PinkRabbit


#include <cstdio>
#include <cstring>
#include <queue>

typedef long long ll;

const int mod=1e9+7;

const int N=5e4+5;

int n,d;

char s[N],x[55],y[55];

int rt,node_cnt,ch[N][10],fa[N],is_end[N];

inline void build_ac(){
	rt=++node_cnt; int lim=d/2;
	for(int i=0;i<=n-lim;++i){
		int u=rt;
		for(int j=0;j<lim;++j){
			int c=s[i+j]-'0';
			if(!ch[u][c]) ch[u][c]=++node_cnt; u=ch[u][c];
		}
		is_end[u]=1;
	}
	std::queue<int> Q;
	for(int c=0;c<10;++c){
		if(!ch[rt][c]) ch[rt][c]=rt;
		else{ int v=ch[rt][c]; fa[v]=rt; Q.push(v); }
	}
	while(!Q.empty()){
		int u=Q.front(); Q.pop();
		for(int c=0;c<10;++c){
			if(!ch[u][c]) ch[u][c]=ch[fa[u]][c];
			else{ int v=ch[u][c]; fa[v]=ch[fa[u]][c]; Q.push(v); }
		}
	}
}

int f[55][N][2],g[55][2];

inline int calc(char *a){
	g[d][0]=g[d][1]=1;
	for(int i=d-1;i>=0;--i){
		int o=a[i]-'0';
		g[i][0]=(ll)10*g[i+1][0]%mod;
		g[i][1]=((ll)o*g[i+1][0]+g[i+1][1])%mod;
	}
	memset(f,0,sizeof(f)); f[0][rt][1]=1;
	for(int i=0;i<d;++i){
		for(int u=1;u<=node_cnt;++u) if(!is_end[u]){
			int o=a[i]-'0';
			for(int c=0;c<10;++c) if(ch[u][c]){
				int v=ch[u][c];
				f[i+1][v][0]=(f[i+1][v][0]+f[i][u][0])%mod;
				if(c<o) f[i+1][v][0]=(f[i+1][v][0]+f[i][u][1])%mod;
				if(c==o) f[i+1][v][1]=(f[i+1][v][1]+f[i][u][1])%mod;
			}
		}
	}
	int ans=0;
	for(int i=1;i<=d;++i){
		for(int u=1;u<=node_cnt;++u) if(is_end[u]){
			ans=((ll)f[i][u][0]*g[i][0]+ans)%mod;
			ans=((ll)f[i][u][1]*g[i][1]+ans)%mod;
		}
	}
	return ans;
}

int main(){
	scanf("%s%s%s",s,x,y);
	n=strlen(s); d=strlen(x); build_ac();
	int k=d-1; while(x[k]=='0') x[k--]='9'; --x[k];
	printf("%d\n",(calc(y)+mod-calc(x))%mod);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int Maxn = 250005, p = 1e9 + 7;
int node_ct;
bool endpos[Maxn];
long long f[Maxn][2], tmp[Maxn][2];
string s, t, S, tmps;
struct Node
{
	int son[10], fail;
}node[Maxn];
void init(string str, int id)
{
	int now = 1, siz = str.size();
	for (int i = 0; i < siz; i++)
	{
		if (!node[now].son[str[i] - '0']) node[now].son[str[i] - '0'] = ++node_ct;
		now = node[now].son[str[i] - '0'];
	}
	endpos[now] = true;
}
queue <int> Qu;
void get_fail(void)
{
	for (int i = 0; i <= 9; i++)
		if (node[1].son[i]) node[node[1].son[i]].fail = 1, Qu.push(node[1].son[i]);
		else node[1].son[i] = 1;
	while (!Qu.empty())
	{
		int u = Qu.front();
		Qu.pop();
		for (int i = 0; i <= 9; i++)
		{
			if (node[u].son[i]) node[node[u].son[i]].fail = node[node[u].fail].son[i], Qu.push(node[u].son[i]);
			else node[u].son[i] = node[node[u].fail].son[i];
		}
	}
}
long long work(string str)
{
	long long tot = 0;
	memset(f, 0, sizeof(f));
	f[1][1] = 1;
	int len = str.size();
	for (int i = 0; i < len; i++)
	{
		memset(tmp, 0, sizeof(tmp));
		for (int j = 1; j <= node_ct; j++)
			if (!endpos[j])
				for (int k = 0; k <= 9; k++)
					if (!endpos[node[j].son[k]])
						(tmp[node[j].son[k]][0] += f[j][0]) %= p;
		for (int j = 1; j <= node_ct; j++)
			if (!endpos[j])
			{
				for (int k = 0; k < str[i] - '0'; k++)
					if (!endpos[node[j].son[k]])
						(tmp[node[j].son[k]][0] += f[j][1]) %= p;
				if (!endpos[node[j].son[str[i] - '0']]) (tmp[node[j].son[str[i] - '0']][1] += f[j][1]) %= p;
			}
		memcpy(f, tmp, sizeof(f));
	}
	for (int i = 1; i <= node_ct; i++)
		(tot += f[i][0] + f[i][1]) %= p;
	long long Tmp = 0;
	for (int i = 0; i < len; i++)
		(Tmp *= 10) %= p, (Tmp += str[i] - '0') %= p;
	return (Tmp - tot + p) % p;
}
int main()
{
	node_ct = 1;
	cin >> S >> s >> t;
	int siz = s.size(), Siz = S.size();
	for (int i = 0; i < Siz - siz / 2 + 1; i++)
	{
		tmps = "";
		for (int j = i; j < i + siz / 2; j++)
			tmps += S[j];
		init(tmps, i);
	}
	tmps = "";
	get_fail();
	int len = s.size(), pos;
	for (int i = len - 1; i >= 0; i--)
		if (s[i] != '0')
		{
			pos = i;
			break;
		}
	for (int i = 0; i < pos; i++)
		tmps += s[i];
	tmps += s[pos] - 1;
	for (int i = pos + 1; i < len; i++)
		tmps += '9';
	printf("%lld\n", (work(t) - work(tmps)) % p);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int Maxn = 250005, p = 1e9 + 7;
int node_ct;
bool endpos[Maxn];
long long f[Maxn][2], tmp[Maxn][2];
string s, t, S, tmps;
struct Node
{
	int son[10], fail;
}node[Maxn];
void init(string str, int id)
{
	int now = 1, siz = str.size();
	for (int i = 0; i < siz; i++)
	{
		if (!node[now].son[str[i] - '0']) node[now].son[str[i] - '0'] = ++node_ct;
		now = node[now].son[str[i] - '0'];
	}
	endpos[now] = true;
}
queue <int> Qu;
void get_fail(void)
{
	for (int i = 0; i <= 9; i++)
		if (node[1].son[i]) node[node[1].son[i]].fail = 1, Qu.push(node[1].son[i]);
		else node[1].son[i] = 1;
	while (!Qu.empty())
	{
		int u = Qu.front();
		Qu.pop();
		for (int i = 0; i <= 9; i++)
		{
			if (node[u].son[i]) node[node[u].son[i]].fail = node[node[u].fail].son[i], Qu.push(node[u].son[i]);
			else node[u].son[i] = node[node[u].fail].son[i];
		}
	}
}
long long work(string str)
{
	long long tot = 0;
	memset(f, 0, sizeof(f));
	f[1][1] = 1;
	int len = str.size();
	for (int i = 0; i < len; i++)
	{
		memset(tmp, 0, sizeof(tmp));
		for (int j = 1; j <= node_ct; j++)
			if (!endpos[j])
				for (int k = 0; k <= 9; k++)
					if (!endpos[node[j].son[k]])
						(tmp[node[j].son[k]][0] += f[j][0]) %= p;
		for (int j = 1; j <= node_ct; j++)
			if (!endpos[j])
			{
				for (int k = 0; k < str[i] - '0'; k++)
					if (!endpos[node[j].son[k]])
						(tmp[node[j].son[k]][0] += f[j][1]) %= p;
				if (!endpos[node[j].son[str[i] - '0']]) (tmp[node[j].son[str[i] - '0']][1] += f[j][1]) %= p;
			}
		memcpy(f, tmp, sizeof(f));
	}
	for (int i = 1; i <= node_ct; i++)
		(tot += f[i][0] + f[i][1]) %= p;
	long long Tmp = 0;
	for (int i = 0; i < len; i++)
		(Tmp *= 10) %= p, (Tmp += str[i] - '0') %= p;
	return (Tmp - tot + p) % p;
}
int main()
{
	node_ct = 1;
	cin >> S >> s >> t;
	int siz = s.size(), Siz = S.size();
	for (int i = 0; i < Siz - siz / 2 + 1; i++)
	{
		tmps = "";
		for (int j = i; j < i + siz / 2; j++)
			tmps += S[j];
		init(tmps, i);
	}
	tmps = "";
	get_fail();
	int len = s.size(), pos;
	for (int i = len - 1; i >= 0; i--)
		if (s[i] != '0')
		{
			pos = i;
			break;
		}
	for (int i = 0; i < pos; i++)
		tmps += s[i];
	tmps += s[pos] - 1;
	for (int i = pos + 1; i < len; i++)
		tmps += '9';
	printf("%lld\n", (work(t) - work(tmps) + p) % p);
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;
const int mod=1000000007;
int n,d;
char s[1003],a[1003],b[1003];
int tot=1,dp[53][25003][2],g[53][2];
struct AC{
	struct Trie{
		int ed,fail,nxt[10];
		Trie(){ed=fail=0;memset(nxt,0,sizeof(nxt));}
	}a[25003];
	void ins(char *s,int len)
	{
		int x=1;
		for(int i=0;i<len;i++)
		{
			if(!a[x].nxt[s[i]-'0']) a[x].nxt[s[i]-'0']=++tot;
			x=a[x].nxt[s[i]-'0'];
		}
		a[x].ed=1;
	}
	void build()
	{
		queue<int> q;
		for(int i=0;i<10;i++)
		{
			if(a[1].nxt[i]) a[a[1].nxt[i]].fail=1,q.push(a[1].nxt[i]);
			else a[1].nxt[i]=1;
		}
		while(!q.empty())
		{
			int x=q.front();
			q.pop();
			for(int i=0;i<10;i++)
			{
				if(a[x].nxt[i])
					a[a[x].nxt[i]].fail=a[a[x].fail].nxt[i],q.push(a[x].nxt[i]);
				else a[x].nxt[i]=a[a[x].fail].nxt[i];
			}
		}
	}
}T;
int calc(char *s)
{
	memset(dp,0,sizeof(dp));
	g[d+1][0]=g[d+1][1]=1;
	for(int i=d;i;i--)
	{
		g[i][0]=1ll*g[i+1][0]*10%mod;
		g[i][1]=(1ll*g[i+1][0]%mod*(s[i]-'0')%mod+g[i+1][1])%mod;
	}
	dp[0][1][1]=1;
	for(int i=0;i<d;i++)
		for(int j=1;j<=tot;j++)
		{
			if(T.a[j].ed) continue;
			for(int k=0;k<10;k++)
			{
				int to=T.a[j].nxt[k];
				if(!to) continue;
				dp[i+1][to][0]=(dp[i+1][to][0]+dp[i][j][0])%mod;
				if(k<s[i+1]-'0')
					dp[i+1][to][0]=(dp[i+1][to][0]+dp[i][j][1])%mod;
				else if(k==s[i+1]-'0')
					dp[i+1][to][1]=(dp[i+1][to][1]+dp[i][j][1])%mod;
			}
		}
	int ans=0;
	for(int i=1;i<=d;i++)
		for(int j=1;j<=tot;j++)
			if(T.a[j].ed) ans=(ans+(1ll*dp[i][j][0]*g[i+1][0]%mod+1ll*dp[i][j][1]*g[i+1][1]%mod)%mod)%mod;
	return ans;
}
int main()
{
	scanf("%s%s%s",s+1,a+1,b+1);
	n=strlen(s+1),d=strlen(a+1);
	for(int i=1;i+d/2-1<=n;i++)
		T.ins(s+i,d/2);
	T.build();
	int t=d;
	while(a[t]=='0') a[t--]='9';
	--a[t];
	printf("%d",calc(b)-calc(a));
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;
const int mod=1000000007;
int n,d;
char s[1003],a[1003],b[1003];
int tot=1,dp[53][25003][2],g[53][2];
struct AC{
	struct Trie{
		int ed,fail,nxt[10];
		Trie(){ed=fail=0;memset(nxt,0,sizeof(nxt));}
	}a[25003];
	void ins(char *s,int len)
	{
		int x=1;
		for(int i=0;i<len;i++)
		{
			if(!a[x].nxt[s[i]-'0']) a[x].nxt[s[i]-'0']=++tot;
			x=a[x].nxt[s[i]-'0'];
		}
		a[x].ed=1;
	}
	void build()
	{
		queue<int> q;
		for(int i=0;i<10;i++)
		{
			if(a[1].nxt[i]) a[a[1].nxt[i]].fail=1,q.push(a[1].nxt[i]);
			else a[1].nxt[i]=1;
		}
		while(!q.empty())
		{
			int x=q.front();
			q.pop();
			for(int i=0;i<10;i++)
			{
				if(a[x].nxt[i])
					a[a[x].nxt[i]].fail=a[a[x].fail].nxt[i],q.push(a[x].nxt[i]);
				else a[x].nxt[i]=a[a[x].fail].nxt[i];
			}
		}
	}
}T;
int calc(char *s)
{
	memset(dp,0,sizeof(dp));
	g[d+1][0]=g[d+1][1]=1;
	for(int i=d;i;i--)
	{
		g[i][0]=1ll*g[i+1][0]*10%mod;
		g[i][1]=(1ll*g[i+1][0]*(s[i]-'0')%mod+g[i+1][1])%mod;
	}
	dp[0][1][1]=1;
	for(int i=0;i<d;i++)
		for(int j=1;j<=tot;j++)
		{
			if(T.a[j].ed) continue;
			for(int k=0;k<10;k++)
			{
				int to=T.a[j].nxt[k];
				if(!to) continue;
				dp[i+1][to][0]=(dp[i+1][to][0]+dp[i][j][0])%mod;
				if(k<s[i+1]-'0')
					dp[i+1][to][0]=(dp[i+1][to][0]+dp[i][j][1])%mod;
				else if(k==s[i+1]-'0')
					dp[i+1][to][1]=(dp[i+1][to][1]+dp[i][j][1])%mod;
			}
		}
	int ans=0;
	for(int i=1;i<=d;i++)
		for(int j=1;j<=tot;j++)
			if(T.a[j].ed) ans=(ans+(1ll*dp[i][j][0]*g[i+1][0]%mod+1ll*dp[i][j][1]*g[i+1][1]%mod)%mod)%mod;
	return ans;
}
int main()
{
	scanf("%s%s%s",s+1,a+1,b+1);
	n=strlen(s+1),d=strlen(a+1);
	for(int i=1;i+d/2-1<=n;i++)
		T.ins(s+i,d/2);
	T.build();
	int t=d;
	while(a[t]=='0') a[t--]='9';
	--a[t];
	printf("%d",(calc(b)-calc(a)+mod)%mod);
	return 0;
}


#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mkp make_pair
#define rint register int
#define INF ((1ll << 62) - 1)
#define FI(n) FastIO::read(n)
#define FO(n) FastIO::write(n)
#define Pair pair < int, int >
#define mst(a,b) memset(a,b,sizeof(a))
#define foR(i, k, j) for(rint i = (k); i >= (j); --i)
#define For(i, k, j) for(rint i = (k); i <= (j); ++i)
#define Foe(i, u) for(rint i = lst[u], v = e[i].v; i; i = e[i].nxt, v = e[i].v)
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define file(s) freopen(s".in", "r", stdin); freopen(s".out", "w", stdout)
#define int long long
const int P = 1000000007; //
using namespace std;
inline void ckmax(int &a, int b) {a = max(a, b);}
inline void ckmin(int &a, int b) {a = min(a, b);}
inline void mulmod(int &a, int b) {a = 1ll * a * b % P;}
inline void addmod(int &a, int b) {int t = a + b; a = (t >= P ? t - P : t); }
inline int ksm(int a, int b) {int ans=1; for(;b;b>>=1) {if(b&1) ans=1ll*ans*a%P;a=1ll*a*a%P;}return ans;}
inline int inv(int a) {return ksm(a, P-2);}
namespace FastIO {
    const int SIZE=1<<16; char buf[SIZE], obuf[SIZE], str[64]; int bi=SIZE, bn=SIZE, opt;
    int read(char *s) {
        while (bn) {for (;bi<bn&&buf[bi]<=' ';bi++);if (bi<bn) break; bn=fread(buf,1,SIZE,stdin),bi=0;}
        int sn=0;while (bn) {for (;bi<bn&&buf[bi]>' ';bi++) s[sn++]=buf[bi];if (bi<bn) break; bn=fread(buf,1,SIZE,stdin),bi=0;}s[sn]=0;return sn;
    }
    bool read(int& x) {if(x)x=0;int bf=0,n=read(str); if(!n)return 0; int i=0; if (str[i]=='-') bf=1,i=1; for(x=0;i<n;i++) x=x*10+str[i]-'0'; if(bf) x=-x; return 1;}
    void write(int x) {
        if(!x) obuf[opt++] = '0'; else {if(x<0) obuf[opt++]='-',x=-x;int sn=0; while(x)str[sn++]=x%10+'0',x/=10;for (int i=sn-1;i>=0;i--) obuf[opt++]=str[i];}
        if (opt>=(SIZE>>1)){fwrite(obuf, 1, opt, stdout); opt=0;}
    }
    void write(char x) {obuf[opt++]=x;if (opt>=(SIZE>>1)){fwrite(obuf, 1, opt, stdout); opt=0;}}
    void Fflush() { if (opt) fwrite(obuf, 1, opt, stdout); opt=0;}
};
const int MAXN = 1e5 + 5;
int n, d;
struct ACAM {
	int nxt[MAXN][26], cnt[MAXN], tot, fail[MAXN];
	ACAM() {tot = 1;}
	void insert(string s) {
		int p = 1;
		For(i, 0, (int)s.size()-1) {
//			cerr << s << endl;
			if(!nxt[p][s[i]-'0'])  nxt[p][s[i]-'0'] = ++tot;
			p = nxt[p][s[i]-'0'];
		}
		cnt[p] = 1;
	}
	void getfail() {
		queue < int > q; int p = 1; fail[1] = 1;
		For(i, 0, 9)
			if(nxt[1][i]) fail[nxt[1][i]] = 1, q.push(nxt[1][i]);
			else nxt[1][i] = 1;
		while(!q.empty()) {
			p = q.front(); q.pop();
			For(i, 0, 9) {
				int v = nxt[p][i];
				if(v) q.push(v), fail[v] = nxt[fail[p]][i];
				else nxt[p][i] = nxt[fail[p]][i];
			}
		}
//		cnt[p] += cnt[fail[p]];
	}
	int f[55][1005*55][2], p[55][2];
	int dp(string t, int d) {
		p[d+1][0] = p[d+1][1] = 1;
		foR(i, d, 0) p[i][0] = p[i+1][0] * 10, p[i][1] = (t[i] - '0') * p[i+1][0] + p[i+1][1];
		mst(f, 0);
		f[0][1][1] = 1;
		For(i, 0, d-1) {
			For(j, 1, tot) {
				if(!cnt[j]) {
//					cerr << j << endl;
					For(k, 0, 9) {
						int o = nxt[j][k];
						addmod(f[i+1][o][0], f[i][j][0]);
						if (k < t[i+1] - '0') addmod(f[i+1][o][0], f[i][j][1]);
						if (k == t[i+1] - '0') addmod(f[i+1][o][1], f[i][j][1]);
					}
				}
			}
		}
		int ans = 0;
		For(i, 1, d) For(j, 1, tot) {
			if (cnt[j]) addmod(ans, (f[i][j][0] * p[i+1][0] % P + f[i][j][1] * p[i+1][1] % P) % P);
		}
//		cerr << ans << endl;
		return ans;
	}

}tr;
signed main()
{
	#ifndef ONLINE_JUDGE
		file("pro");
	#endif
	string s, x, y; cin >> s >> x >> y;
//	cerr << s << ' ' << x << ' ' << y << endl;
	n = s.size(), d = y.size(); x = ' ' + x, y = ' ' + y;
	int k = d;
	while (x[k] == '0') x[k--] = '9'; x[k]--;
//	cerr << x << endl;
//	cerr << n - d / 2 << endl;
	For(i, 0, n - d / 2) {
		string t = "";
		For(j, i, i + d / 2 - 1) {
			t += s[j];
		}
//		cerr << t << endl;
		tr.insert(t);
//		cerr << "*";
	}
	tr.getfail();
	printf("%lld\n", tr.dp(y, d) - tr.dp(x, d));
    return FastIO::Fflush(), 0;
}
/*
LXRXLXL
*/


#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mkp make_pair
#define rint register int
#define INF ((1ll << 62) - 1)
#define FI(n) FastIO::read(n)
#define FO(n) FastIO::write(n)
#define Pair pair < int, int >
#define mst(a,b) memset(a,b,sizeof(a))
#define foR(i, k, j) for(rint i = (k); i >= (j); --i)
#define For(i, k, j) for(rint i = (k); i <= (j); ++i)
#define Foe(i, u) for(rint i = lst[u], v = e[i].v; i; i = e[i].nxt, v = e[i].v)
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define file(s) freopen(s".in", "r", stdin); freopen(s".out", "w", stdout)
#define int long long
const int P = 1000000007; //
using namespace std;
inline void ckmax(int &a, int b) {a = max(a, b);}
inline void ckmin(int &a, int b) {a = min(a, b);}
inline void mulmod(int &a, int b) {a = 1ll * a * b % P;}
inline void addmod(int &a, int b) {a = (a + b + P) % P;}
inline int ksm(int a, int b) {int ans=1; for(;b;b>>=1) {if(b&1) ans=1ll*ans*a%P;a=1ll*a*a%P;}return ans;}
inline int inv(int a) {return ksm(a, P-2);}
namespace FastIO {
    const int SIZE=1<<16; char buf[SIZE], obuf[SIZE], str[64]; int bi=SIZE, bn=SIZE, opt;
    int read(char *s) {
        while (bn) {for (;bi<bn&&buf[bi]<=' ';bi++);if (bi<bn) break; bn=fread(buf,1,SIZE,stdin),bi=0;}
        int sn=0;while (bn) {for (;bi<bn&&buf[bi]>' ';bi++) s[sn++]=buf[bi];if (bi<bn) break; bn=fread(buf,1,SIZE,stdin),bi=0;}s[sn]=0;return sn;
    }
    bool read(int& x) {if(x)x=0;int bf=0,n=read(str); if(!n)return 0; int i=0; if (str[i]=='-') bf=1,i=1; for(x=0;i<n;i++) x=x*10+str[i]-'0'; if(bf) x=-x; return 1;}
    void write(int x) {
        if(!x) obuf[opt++] = '0'; else {if(x<0) obuf[opt++]='-',x=-x;int sn=0; while(x)str[sn++]=x%10+'0',x/=10;for (int i=sn-1;i>=0;i--) obuf[opt++]=str[i];}
        if (opt>=(SIZE>>1)){fwrite(obuf, 1, opt, stdout); opt=0;}
    }
    void write(char x) {obuf[opt++]=x;if (opt>=(SIZE>>1)){fwrite(obuf, 1, opt, stdout); opt=0;}}
    void Fflush() { if (opt) fwrite(obuf, 1, opt, stdout); opt=0;}
};
const int MAXN = 1e5 + 5;
int n, d;
struct ACAM {
	int nxt[MAXN][26], cnt[MAXN], tot, fail[MAXN];
	ACAM() {tot = 1;}
	void insert(string s) {
		int p = 1;
		For(i, 0, (int)s.size()-1) {
//			cerr << s << endl;
			if(!nxt[p][s[i]-'0'])  nxt[p][s[i]-'0'] = ++tot;
			p = nxt[p][s[i]-'0'];
		}
		cnt[p] = 1;
	}
	void getfail() {
		queue < int > q; int p = 1; fail[1] = 1;
		For(i, 0, 9)
			if(nxt[1][i]) fail[nxt[1][i]] = 1, q.push(nxt[1][i]);
			else nxt[1][i] = 1;
		while(!q.empty()) {
			p = q.front(); q.pop();
			For(i, 0, 9) {
				int v = nxt[p][i];
				if(v) q.push(v), fail[v] = nxt[fail[p]][i];
				else nxt[p][i] = nxt[fail[p]][i];
			}
		}
//		cnt[p] += cnt[fail[p]];
	}
	int f[55][1005*55][2], p[55][2];
	int dp(string t, int d) {
		p[d+1][0] = p[d+1][1] = 1;
		foR(i, d, 0) p[i][0] = p[i+1][0] * 10 % P, p[i][1] = ((t[i] - '0') * p[i+1][0] + p[i+1][1]) % P;
		mst(f, 0);
		f[0][1][1] = 1;
		For(i, 0, d-1) {
			For(j, 1, tot) {
				if(!cnt[j]) {
//					cerr << j << endl;
					For(k, 0, 9) {
						int o = nxt[j][k];
						addmod(f[i+1][o][0], f[i][j][0]);
						if (k < t[i+1] - '0') addmod(f[i+1][o][0], f[i][j][1]);
						if (k == t[i+1] - '0') addmod(f[i+1][o][1], f[i][j][1]);
					}
				}
			}
		}
		int ans = 0;
		For(i, 1, d) For(j, 1, tot) {
			if (cnt[j]) addmod(ans, (f[i][j][0] * p[i+1][0] % P + f[i][j][1] * p[i+1][1] % P) % P);
		}
//		cerr << ans << endl;
		return ans;
	}

}tr;
signed main()
{
	#ifndef ONLINE_JUDGE
		file("pro");
	#endif
	string s, x, y; cin >> s >> x >> y;
//	cerr << s << ' ' << x << ' ' << y << endl;
	n = s.size(), d = y.size(); x = ' ' + x, y = ' ' + y;
	int k = d;
	while (x[k] == '0') x[k--] = '9'; x[k]--;
//	cerr << x << endl;
//	cerr << n - d / 2 << endl;
	For(i, 0, n - d / 2) {
		string t = "";
		For(j, i, i + d / 2 - 1) {
			t += s[j];
		}
//		cerr << t << endl;
		tr.insert(t);
//		cerr << "*";
	}
	tr.getfail();
	printf("%lld\n", (tr.dp(y, d) - tr.dp(x, d) + P) % P);
    return FastIO::Fflush(), 0;
}
/*
LXRXLXL
*/


#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mkp make_pair
#define rint register int
#define INF ((1ll << 62) - 1)
#define FI(n) FastIO::read(n)
#define FO(n) FastIO::write(n)
#define Pair pair < int, int >
#define mst(a,b) memset(a,b,sizeof(a))
#define foR(i, k, j) for(rint i = (k); i >= (j); --i)
#define For(i, k, j) for(rint i = (k); i <= (j); ++i)
#define Foe(i, u) for(rint i = lst[u], v = e[i].v; i; i = e[i].nxt, v = e[i].v)
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define file(s) freopen(s".in", "r", stdin); freopen(s".out", "w", stdout)
#define int long long
const int P = 1000000007; //
using namespace std;
inline void ckmax(int &a, int b) {a = max(a, b);}
inline void ckmin(int &a, int b) {a = min(a, b);}
inline void mulmod(int &a, int b) {a = 1ll * a * b % P;}
inline void addmod(int &a, int b) {int t = a + b; a = (t >= P ? t - P : t); }
inline int ksm(int a, int b) {int ans=1; for(;b;b>>=1) {if(b&1) ans=1ll*ans*a%P;a=1ll*a*a%P;}return ans;}
inline int inv(int a) {return ksm(a, P-2);}
namespace FastIO {
    const int SIZE=1<<16; char buf[SIZE], obuf[SIZE], str[64]; int bi=SIZE, bn=SIZE, opt;
    int read(char *s) {
        while (bn) {for (;bi<bn&&buf[bi]<=' ';bi++);if (bi<bn) break; bn=fread(buf,1,SIZE,stdin),bi=0;}
        int sn=0;while (bn) {for (;bi<bn&&buf[bi]>' ';bi++) s[sn++]=buf[bi];if (bi<bn) break; bn=fread(buf,1,SIZE,stdin),bi=0;}s[sn]=0;return sn;
    }
    bool read(int& x) {if(x)x=0;int bf=0,n=read(str); if(!n)return 0; int i=0; if (str[i]=='-') bf=1,i=1; for(x=0;i<n;i++) x=x*10+str[i]-'0'; if(bf) x=-x; return 1;}
    void write(int x) {
        if(!x) obuf[opt++] = '0'; else {if(x<0) obuf[opt++]='-',x=-x;int sn=0; while(x)str[sn++]=x%10+'0',x/=10;for (int i=sn-1;i>=0;i--) obuf[opt++]=str[i];}
        if (opt>=(SIZE>>1)){fwrite(obuf, 1, opt, stdout); opt=0;}
    }
    void write(char x) {obuf[opt++]=x;if (opt>=(SIZE>>1)){fwrite(obuf, 1, opt, stdout); opt=0;}}
    void Fflush() { if (opt) fwrite(obuf, 1, opt, stdout); opt=0;}
};
const int MAXN = 1e5 + 5;
int n, d;
struct ACAM {
	int nxt[MAXN][26], cnt[MAXN], tot, fail[MAXN];
	ACAM() {tot = 1;}
	void insert(string s) {
		int p = 1;
		For(i, 0, (int)s.size()-1) {
//			cerr << s << endl;
			if(!nxt[p][s[i]-'0'])  nxt[p][s[i]-'0'] = ++tot;
			p = nxt[p][s[i]-'0'];
		}
		cnt[p] = 1;
	}
	void getfail() {
		queue < int > q; int p = 1; fail[1] = 1;
		For(i, 0, 9)
			if(nxt[1][i]) fail[nxt[1][i]] = 1, q.push(nxt[1][i]);
			else nxt[1][i] = 1;
		while(!q.empty()) {
			p = q.front(); q.pop();
			For(i, 0, 9) {
				int v = nxt[p][i];
				if(v) q.push(v), fail[v] = nxt[fail[p]][i];
				else nxt[p][i] = nxt[fail[p]][i];
			}
		}
//		cnt[p] += cnt[fail[p]];
	}
	int f[55][1005*55][2], p[55][2];
	int dp(string t, int d) {
		p[d+1][0] = p[d+1][1] = 1;
		foR(i, d, 0) p[i][0] = p[i+1][0] * 10 % P, p[i][1] = ((t[i] - '0') * p[i+1][0] + p[i+1][1]) % P;
		mst(f, 0);
		f[0][1][1] = 1;
		For(i, 0, d-1) {
			For(j, 1, tot) {
				if(!cnt[j]) {
//					cerr << j << endl;
					For(k, 0, 9) {
						int o = nxt[j][k];
						addmod(f[i+1][o][0], f[i][j][0]);
						if (k < t[i+1] - '0') addmod(f[i+1][o][0], f[i][j][1]);
						if (k == t[i+1] - '0') addmod(f[i+1][o][1], f[i][j][1]);
					}
				}
			}
		}
		int ans = 0;
		For(i, 1, d) For(j, 1, tot) {
			if (cnt[j]) addmod(ans, (f[i][j][0] * p[i+1][0] % P + f[i][j][1] * p[i+1][1] % P) % P);
		}
//		cerr << ans << endl;
		return ans;
	}

}tr;
signed main()
{
	#ifndef ONLINE_JUDGE
		file("pro");
	#endif
	string s, x, y; cin >> s >> x >> y;
//	cerr << s << ' ' << x << ' ' << y << endl;
	n = s.size(), d = y.size(); x = ' ' + x, y = ' ' + y;
	int k = d;
	while (x[k] == '0') x[k--] = '9'; x[k]--;
//	cerr << x << endl;
//	cerr << n - d / 2 << endl;
	For(i, 0, n - d / 2) {
		string t = "";
		For(j, i, i + d / 2 - 1) {
			t += s[j];
		}
//		cerr << t << endl;
		tr.insert(t);
//		cerr << "*";
	}
	tr.getfail();
	printf("%lld\n", tr.dp(y, d) - tr.dp(x, d));
    return FastIO::Fflush(), 0;
}
/*
LXRXLXL
*/


#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mkp make_pair
#define rint register int
#define INF ((1ll << 62) - 1)
#define FI(n) FastIO::read(n)
#define FO(n) FastIO::write(n)
#define Pair pair < int, int >
#define mst(a,b) memset(a,b,sizeof(a))
#define foR(i, k, j) for(rint i = (k); i >= (j); --i)
#define For(i, k, j) for(rint i = (k); i <= (j); ++i)
#define Foe(i, u) for(rint i = lst[u], v = e[i].v; i; i = e[i].nxt, v = e[i].v)
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define file(s) freopen(s".in", "r", stdin); freopen(s".out", "w", stdout)
#define int long long
const int P = 1000000007; //
using namespace std;
inline void ckmax(int &a, int b) {a = max(a, b);}
inline void ckmin(int &a, int b) {a = min(a, b);}
inline void mulmod(int &a, int b) {a = 1ll * a * b % P;}
inline void addmod(int &a, int b) {a = (a + b + P) % P;}
inline int ksm(int a, int b) {int ans=1; for(;b;b>>=1) {if(b&1) ans=1ll*ans*a%P;a=1ll*a*a%P;}return ans;}
inline int inv(int a) {return ksm(a, P-2);}
namespace FastIO {
    const int SIZE=1<<16; char buf[SIZE], obuf[SIZE], str[64]; int bi=SIZE, bn=SIZE, opt;
    int read(char *s) {
        while (bn) {for (;bi<bn&&buf[bi]<=' ';bi++);if (bi<bn) break; bn=fread(buf,1,SIZE,stdin),bi=0;}
        int sn=0;while (bn) {for (;bi<bn&&buf[bi]>' ';bi++) s[sn++]=buf[bi];if (bi<bn) break; bn=fread(buf,1,SIZE,stdin),bi=0;}s[sn]=0;return sn;
    }
    bool read(int& x) {if(x)x=0;int bf=0,n=read(str); if(!n)return 0; int i=0; if (str[i]=='-') bf=1,i=1; for(x=0;i<n;i++) x=x*10+str[i]-'0'; if(bf) x=-x; return 1;}
    void write(int x) {
        if(!x) obuf[opt++] = '0'; else {if(x<0) obuf[opt++]='-',x=-x;int sn=0; while(x)str[sn++]=x%10+'0',x/=10;for (int i=sn-1;i>=0;i--) obuf[opt++]=str[i];}
        if (opt>=(SIZE>>1)){fwrite(obuf, 1, opt, stdout); opt=0;}
    }
    void write(char x) {obuf[opt++]=x;if (opt>=(SIZE>>1)){fwrite(obuf, 1, opt, stdout); opt=0;}}
    void Fflush() { if (opt) fwrite(obuf, 1, opt, stdout); opt=0;}
};
const int MAXN = 1e5 + 5;
int n, d;
struct ACAM {
	int nxt[MAXN][26], cnt[MAXN], tot, fail[MAXN];
	ACAM() {tot = 1;}
	void insert(string s) {
		int p = 1;
		For(i, 0, (int)s.size()-1) {
//			cerr << s << endl;
			if(!nxt[p][s[i]-'0'])  nxt[p][s[i]-'0'] = ++tot;
			p = nxt[p][s[i]-'0'];
		}
		cnt[p] = 1;
	}
	void getfail() {
		queue < int > q; int p = 1; fail[1] = 1;
		For(i, 0, 9)
			if(nxt[1][i]) fail[nxt[1][i]] = 1, q.push(nxt[1][i]);
			else nxt[1][i] = 1;
		while(!q.empty()) {
			p = q.front(); q.pop();
			For(i, 0, 9) {
				int v = nxt[p][i];
				if(v) q.push(v), fail[v] = nxt[fail[p]][i];
				else nxt[p][i] = nxt[fail[p]][i];
			}
		}
//		cnt[p] += cnt[fail[p]];
	}
	int f[55][1005*55][2], p[55][2];
	int dp(string t, int d) {
		p[d+1][0] = p[d+1][1] = 1;
		foR(i, d, 0) p[i][0] = p[i+1][0] * 10 % P, p[i][1] = ((t[i] - '0') * p[i+1][0] + p[i+1][1]) % P;
		mst(f, 0);
		f[0][1][1] = 1;
		For(i, 0, d-1) {
			For(j, 1, tot) {
				if(!cnt[j]) {
//					cerr << j << endl;
					For(k, 0, 9) {
						int o = nxt[j][k];
						addmod(f[i+1][o][0], f[i][j][0]);
						if (k < t[i+1] - '0') addmod(f[i+1][o][0], f[i][j][1]);
						if (k == t[i+1] - '0') addmod(f[i+1][o][1], f[i][j][1]);
					}
				}
			}
		}
		int ans = 0;
		For(i, 1, d) For(j, 1, tot) {
			if (cnt[j]) addmod(ans, (f[i][j][0] * p[i+1][0] % P + f[i][j][1] * p[i+1][1] % P) % P);
		}
//		cerr << ans << endl;
		return ans;
	}

}tr;
signed main()
{
	#ifndef ONLINE_JUDGE
		file("pro");
	#endif
	string s, x, y; cin >> s >> x >> y;
//	cerr << s << ' ' << x << ' ' << y << endl;
	n = s.size(), d = y.size(); x = ' ' + x, y = ' ' + y;
	int k = d;
	while (x[k] == '0') x[k--] = '9'; x[k]--;
//	cerr << x << endl;
//	cerr << n - d / 2 << endl;
	For(i, 0, n - d / 2) {
		string t = "";
		For(j, i, i + d / 2 - 1) {
			t += s[j];
		}
//		cerr << t << endl;
		tr.insert(t);
//		cerr << "*";
	}
	tr.getfail();
	printf("%lld\n", tr.dp(y, d) - tr.dp(x, d));
    return FastIO::Fflush(), 0;
}
/*
LXRXLXL
*/


#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mkp make_pair
#define rint register int
#define INF ((1ll << 62) - 1)
#define FI(n) FastIO::read(n)
#define FO(n) FastIO::write(n)
#define Pair pair < int, int >
#define mst(a,b) memset(a,b,sizeof(a))
#define foR(i, k, j) for(rint i = (k); i >= (j); --i)
#define For(i, k, j) for(rint i = (k); i <= (j); ++i)
#define Foe(i, u) for(rint i = lst[u], v = e[i].v; i; i = e[i].nxt, v = e[i].v)
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define file(s) freopen(s".in", "r", stdin); freopen(s".out", "w", stdout)
#define int long long
const int P = 1000000007; //
using namespace std;
inline void ckmax(int &a, int b) {a = max(a, b);}
inline void ckmin(int &a, int b) {a = min(a, b);}
inline void mulmod(int &a, int b) {a = 1ll * a * b % P;}
inline void addmod(int &a, int b) {int t = a + b; a = (t >= P ? t - P : t); }
inline int ksm(int a, int b) {int ans=1; for(;b;b>>=1) {if(b&1) ans=1ll*ans*a%P;a=1ll*a*a%P;}return ans;}
inline int inv(int a) {return ksm(a, P-2);}
namespace FastIO {
    const int SIZE=1<<16; char buf[SIZE], obuf[SIZE], str[64]; int bi=SIZE, bn=SIZE, opt;
    int read(char *s) {
        while (bn) {for (;bi<bn&&buf[bi]<=' ';bi++);if (bi<bn) break; bn=fread(buf,1,SIZE,stdin),bi=0;}
        int sn=0;while (bn) {for (;bi<bn&&buf[bi]>' ';bi++) s[sn++]=buf[bi];if (bi<bn) break; bn=fread(buf,1,SIZE,stdin),bi=0;}s[sn]=0;return sn;
    }
    bool read(int& x) {if(x)x=0;int bf=0,n=read(str); if(!n)return 0; int i=0; if (str[i]=='-') bf=1,i=1; for(x=0;i<n;i++) x=x*10+str[i]-'0'; if(bf) x=-x; return 1;}
    void write(int x) {
        if(!x) obuf[opt++] = '0'; else {if(x<0) obuf[opt++]='-',x=-x;int sn=0; while(x)str[sn++]=x%10+'0',x/=10;for (int i=sn-1;i>=0;i--) obuf[opt++]=str[i];}
        if (opt>=(SIZE>>1)){fwrite(obuf, 1, opt, stdout); opt=0;}
    }
    void write(char x) {obuf[opt++]=x;if (opt>=(SIZE>>1)){fwrite(obuf, 1, opt, stdout); opt=0;}}
    void Fflush() { if (opt) fwrite(obuf, 1, opt, stdout); opt=0;}
};
const int MAXN = 1e5 + 5;
int n, d;
struct ACAM {
	int nxt[MAXN][26], cnt[MAXN], tot, fail[MAXN];
	ACAM() {tot = 1;}
	void insert(string s) {
		int p = 1;
		For(i, 0, (int)s.size()-1) {
//			cerr << s << endl;
			if(!nxt[p][s[i]-'0'])  nxt[p][s[i]-'0'] = ++tot;
			p = nxt[p][s[i]-'0'];
		}
		cnt[p] = 1;
	}
	void getfail() {
		queue < int > q; int p = 1; fail[1] = 1;
		For(i, 0, 9)
			if(nxt[1][i]) fail[nxt[1][i]] = 1, q.push(nxt[1][i]);
		while(!q.empty()) {
			p = q.front(); q.pop();
			For(i, 0, 9) {
				int v = nxt[p][i];
				if(v) q.push(v), fail[v] = nxt[fail[p]][i];
				else nxt[p][i] = nxt[fail[p]][i];
			}
		}
//		cnt[p] += cnt[fail[p]];
	}
	int f[55][1005*55][2], p[55][2];
	int dp(string t, int d) {
		p[d+1][0] = p[d+1][1] = 1;
		foR(i, d, 0) p[i][0] = p[i+1][0] * 10, p[i][1] = (t[i] - '0') * p[i+1][0] + p[i+1][1];
//		cerr << t << ' ' << d << endl;
		mst(f, 0);
		f[0][1][1] = 1;
		For(i, 0, d-1) {
			For(j, 1, tot) {
				if(!cnt[j]) {
//					cerr << j << endl;
					For(k, 0, 9) {
						int o = nxt[j][k];
						addmod(f[i+1][o][0], f[i][j][0]);
						if (k < t[i+1] - '0') addmod(f[i+1][o][0], f[i][j][1]);
						if (k == t[i+1] - '0') addmod(f[i+1][o][1], f[i][j][1]);
					}
				}
			}
		}
		int ans = 0;
		For(i, 1, d) For(j, 1, tot) {
			cerr << f[i][j][0] << ' ' << f[i][j][1] << endl;
			if (cnt[j]) addmod(ans, (f[i][j][0] * p[i+1][0] % P + f[i][j][1] * p[i+1][1] % P) % P);
		}
		cerr << ans << endl;
		return ans;
	}

}tr;
signed main()
{
	#ifndef ONLINE_JUDGE
		file("pro");
	#endif
	string s, x, y; cin >> s >> x >> y;
//	cerr << s << ' ' << x << ' ' << y << endl;
	n = s.size(), d = y.size(); x = ' ' + x, y = ' ' + y;
	int k = d;
	while (x[k] == '0') x[k--] = '9'; x[k]--;
//	cerr << x << endl;
//	cerr << n - d / 2 << endl;
	For(i, 0, n - d / 2) {
		string t = "";
		For(j, i, i + d / 2 - 1) {
			t += s[j];
		}
//		cerr << t << endl;
		tr.insert(t);
//		cerr << "*";
	}
	tr.getfail();
	printf("%lld\n", tr.dp(y, d) - tr.dp(x, d));
    return FastIO::Fflush(), 0;
}
/*
LXRXLXL
*/


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int kcz=1000000007;
const int maxn=60005;
const int maxd=55;
struct node
{
    int ne[26],pre,sz;
    inline node() { memset(ne,-1,sizeof(ne)); pre=0; sz=0; }
}ch[maxn];
int tot;
inline void add(char *str)
{
    int i;
    for(i=0;*str;i=ch[i].ne[*str-'0'],str++)
        if(ch[i].ne[*str-'0']==-1)
            ch[i].ne[*str-'0']=++tot;
    ch[i].sz++;
}
inline void ac()
{
    int i,j,k;
    queue<int> que;
    while(!que.empty()) que.pop();
    que.push(0); ch[0].pre=-1;
    while(!que.empty())
    {
        i=que.front(),que.pop();
        for(j=0;j<26;j++)
            if(ch[i].ne[j]!=-1)
            {
                for(k=ch[i].pre;k!=-1;)
                    if(ch[k].ne[j]!=-1)
                        break;
                    else k=ch[k].pre;
                if(k==-1) ch[ch[i].ne[j]].pre=0;
                else ch[ch[i].ne[j]].pre=ch[k].ne[j];
                que.push(ch[i].ne[j]);
            }
    }
}
char temp[maxn],l[maxn],r[maxn];
int n;
ll f[maxd][maxn],g[maxd][maxn];
inline int next_(int cur,char c)
{
    while(cur!=-1 && ch[cur].ne[c-'0']==-1)
        cur=ch[cur].pre;
    if(cur==-1) cur=0;
    else cur=ch[cur].ne[c-'0'];
    return cur;
}
inline int check(char *s)
{
    int i,cur=0;
    for(i=0;s[i];i++)
    {
        cur=next_(cur,s[i]);
        if(ch[cur].sz) return 1;
    }
    return 0;
}
inline ll solve(char *s)
{
    int i,j,k,m,_,cur=0; m=strlen(s);
    ll res=0;
//    for(i=1;i<m;i++)
//        (res+=g[i][0])%=kcz;
    for(_=0;_<m;_++)
    {
#define g f
        memset(g,0,sizeof(g));
        g[0][cur]=1;
        for(i=1;i<=m-_;i++)
            for(j=0;j<=tot;j++)
                for(k=(!_ && i==1)?'1':'0';k<=((i==1)?s[_]-1:'9');k++)
                    if(!ch[j].sz)
                        (g[i][next_(j,k)]+=g[i-1][j])%=kcz;
                    else (g[i][j]+=g[i-1][j])%=kcz;
        for(i=0;i<=tot;i++)
            if(ch[i].sz)
                (res+=g[m-_][i])%=kcz;
#undef g
        if(!ch[cur].sz) cur=next_(cur,s[_]);
    }
    if(ch[cur].sz) (res+=1)%=kcz;
    return res;
}
int main()
{
    int i,j,k;
    scanf("%s%s%s",temp,l,r),n=strlen(l),k=strlen(temp);
    for(tot=0,i=k-n/2;i>=0;i--) temp[i+n/2]='\0',add(temp+i);
    ac();
//    for(i=0;i<tot;i++) g[1][i]=0;
//    memset(g,0,sizeof(g));
//    for(i='1';i<='9';i++) g[1][next_(0,i)]++;
////    n=max(strlen(l),strlen(r));
//    for(i=2;i<=n;i++)
//        for(j=0;j<=tot;j++)
//            if(!ch[j].sz)
//                for(k='0';k<='9';k++)
//                    (g[i][next_(j,k)]+=g[i-1][j])%=kcz;
//            else (g[i][j]+=g[i-1][j])%=kcz;
//    for(i=1;i<=n;i++)
//        for(g[i][0]=0,j=1;j<=tot;j++)
//            if(ch[j].sz)
//                (g[i][0]+=g[i][j])%=kcz;
    printf("%lld\n",(solve(r)-solve(l)+check(l)+kcz)%kcz);
    return 0;
}


// Problem: CF585F Digits of Number Pi
// Contest: Luogu
// URL: https://www.luogu.com.cn/problem/CF585F
// Memory Limit: 250 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tune=native")
//
//#include <immintrin.h>
//#include <emmintrin.h>

#include <bits/stdc++.h>
//#pragma GCC optimize("O2")
#define vi vector<int>
#define pii pair<int, int >
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define LL long long
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=n;i>=a;i--)
#define all(x) (x).begin(), (x).end()
#define all2(x,n) (x+1), (x+1+n)
#define sz(x) ((int)(x).size())
#define mod(x) ((x)%MOD)
#define debug(x) cerr<<#x<<" : "<<x<<endl
#define mt make_tuple
#define eb emplace_back
#define o(X) (1<<(X))
#define oL(X) (1LL<<(X))
#define contain(S,X) (((S)&o(X))!=0)
#define containL(S,X) (((S)&oL(X))!=0)
#define ppt(x) __builtin_popcount(x)
using namespace std;
const int INF=0x3f3f3f3f,N=1e6+5,MOD=1e9+7;
const LL INF_LL=0x3f3f3f3f3f3f3f3fLL;
inline int getplc(int x,int y) { return (x>>y)&1; }
template<typename T>
T square(T x) {return x*x;}
LL qpow(LL a,LL b=MOD-2,LL _MOD=MOD){
	LL res=1;
	for(;b;b>>=1,a=a*a%_MOD){
		if(b&1)res=res*a%_MOD;
	}
	return res;
}
// Smax
//int Smax() { return -INF; }
template <typename T>
T Smax(T x) { return x; }
template<typename T, typename... Args>
T Smax(T a, Args... args) { return max(a, Smax(args...)); }
// Smin
template <typename T>
T Smin(T x) { return x; }
template<typename T, typename... Args>
T Smin(T a, Args... args) { return min(a, Smin(args...)); }
template <typename T>
// erro
#define errorl(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); errl(_it, args); }

void errl(istream_iterator<string> it) {}
template<typename T, typename... Args>
void errl(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	errl(++it, args...);
}

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cerr<<endl;}
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << "=" << a << " # ";
	err(++it, args...);
}
void Solve();
int main() {
#ifndef ONLINE_JUDGE
//	freopen("in.txt","r",stdin);
//    freopen("o1.txt","w",stdout);
#endif
	ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
	Solve();
	return 0;
}

//////////////////////////////////////////////////////////////////

template<const int &MOD>
struct _m_int {
	int val;

	_m_int(int64_t v = 0) {
		if (v < 0) v = v % MOD + MOD;
		if (v >= MOD) v %= MOD;
		val = int(v);
	}

	static int inv_mod(int a, int m = MOD) {
		// https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm#Example
		int g = m, r = a, x = 0, y = 1;

		while (r != 0) {
			int q = g / r;
			g %= r; swap(g, r);
			x -= q * y; swap(x, y);
		}

		return x < 0 ? x + m : x;
	}

	explicit operator int() const { return val; }
	explicit operator int64_t() const { return val; }

	_m_int& operator+=(const _m_int &other) {
		val -= MOD - other.val;
		if (val < 0) val += MOD;
		return *this;
	}

	_m_int& operator-=(const _m_int &other) {
		val -= other.val;
		if (val < 0) val += MOD;
		return *this;
	}

	static unsigned fast_mod(uint64_t x, unsigned m = MOD) {
#if !defined(_WIN32) || defined(_WIN64)
		return unsigned(x % m);
#endif
		// Optimized mod for Codeforces 32-bit machines.
		// x must be less than 2^32 * m for this to work, so that x / m fits in an unsigned 32-bit int.
		unsigned x_high = unsigned(x >> 32), x_low = unsigned(x);
		unsigned quot, rem;
		asm("divl %4\n"
		: "=a" (quot), "=d" (rem)
		: "d" (x_high), "a" (x_low), "r" (m));
		return rem;
	}

	_m_int& operator*=(const _m_int &other) {
		val = fast_mod(uint64_t(val) * other.val);
		return *this;
	}

	_m_int& operator/=(const _m_int &other) {
		return *this *= other.inv();
	}

	friend _m_int operator+(const _m_int &a, const _m_int &b) { return _m_int(a) += b; }
	friend _m_int operator-(const _m_int &a, const _m_int &b) { return _m_int(a) -= b; }
	friend _m_int operator*(const _m_int &a, const _m_int &b) { return _m_int(a) *= b; }
	friend _m_int operator/(const _m_int &a, const _m_int &b) { return _m_int(a) /= b; }

	_m_int& operator++() {
		val = val == MOD - 1 ? 0 : val + 1;
		return *this;
	}

	_m_int& operator--() {
		val = val == 0 ? MOD - 1 : val - 1;
		return *this;
	}

	_m_int operator++(int) { _m_int before = *this; ++*this; return before; }
	_m_int operator--(int) { _m_int before = *this; --*this; return before; }

	_m_int operator-() const {
		return val == 0 ? 0 : MOD - val;
	}

	bool operator==(const _m_int &other) const { return val == other.val; }
	bool operator!=(const _m_int &other) const { return val != other.val; }

	_m_int inv() const {
		return inv_mod(val);
	}

	_m_int pow(int64_t p) const {
		if (p < 0)
			return inv().pow(-p);

		_m_int a = *this, result = 1;

		while (p > 0) {
			if (p & 1)
				result *= a;

			p >>= 1;

			if (p > 0)
				a *= a;
		}

		return result;
	}

	friend ostream& operator<<(ostream &os, const _m_int &m) {
		return os << m.val;
	}
};

extern const int _MOD = 1e9+7;
using mint = _m_int<_MOD>;

struct state{
  int len,link;
  int next[12];
};
const int MAX_LEN=2*4e3+5;
state st[MAX_LEN];
int sz,last;
void sam_init(){
  st[0].len=0;
  st[0].link=-1;
  sz++;
  last=0;
}
int cnt[MAX_LEN];
void sam_extend(int c){
  int cur=sz++;
  cnt[cur]++;
  st[cur].len=st[last].len+1;
  int p=last;
  while(p!=-1&&!st[p].next[c]){
    st[p].next[c]=cur;
    p=st[p].link;
  }
  if(p==-1) st[cur].link=0;
  else{
    int q=st[p].next[c];
    if(st[p].len+1==st[q].len) st[cur].link=q;
    else{
      int clone=sz++;
      st[clone]=st[q];
      st[clone].len=st[p].len+1;
      while(p!=-1&&st[p].next[c]==q){
        st[p].next[c]=clone;
        p=st[p].link;
      }
      st[q].link=st[cur].link=clone;
    }
  }
  last=cur;
}

int n,d,leng;
char s[N],a[N],b[N];

mint f[55][3005][55][2][2];
mint solve(char *s,int x,int cur,int len,int lim,int flag){
  if(x>leng)return mint(flag);
  if(~f[x][cur][len][lim][flag].val)return f[x][cur][len][lim][flag];
  int up=lim?s[x]-'0':9;
  mint ans;
  rep(i,0,up){
    if(flag)ans+=solve(s,x+1,cur,len,lim&(i==up),flag);
    else{
      int p=cur;
      if(st[p].next[i])
        ans+=solve(s,x+1,st[p].next[i],len+1,lim&(i==up),
          len+1>=d/2);
      else{
        while(~p&&!st[p].next[i])p=st[p].link;
        if(~p)
          ans+=solve(s,x+1,st[p].next[i],st[p].len+1,lim&(i==up),
            st[p].len+1>=d/2);
        else
          ans+=solve(s,x+1,0,0,lim&(i==up),0);
      }
    }
  }
  f[x][cur][len][lim][flag]=ans;
  return ans;
}

mint work(char *s){
  leng=strlen(s+1);
  rep(i1,0,51)
  rep(i2,0,3002)
  rep(i3,0,51)
  rep(i4,0,1)
  rep(i5,0,1)
  f[i1][i2][i3][i4][i5].val=-1;
  return solve(s,1,0,0,1,0);
}

void Solve(){
  cin>>s+1>>a+1>>b+1;
  n=strlen(s+1),d=strlen(a+1);
  a[d]--;
  per(i,1,d)if(a[i]=='0'+-1)a[i-1]--,a[i]='9';else break;
  sam_init();
  rep(i,1,n)sam_extend(s[i]-'0');
  mint ans=work(b)-work(a);
  cout<<ans<<endl;
}


#include<bits/stdc++.h>
#define cs const
#define pb push_back
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
cs int N = 2e3 + 50;
cs int M = 55;
cs int Mod = 1e9 + 7;
int add(int a, int b){ return a + b >= Mod ? a + b - Mod : a + b; }
int dec(int a, int b){ return a - b < 0 ? a - b + Mod : a - b; }
void Add(int &a, int b){ a = add(a,b); }
void Dec(int &a, int b){ a = dec(a,b); }
int n, d, a[M]; char S[N];
namespace SAM{
	int ch[N][10], len[N], lk[N], nd=1, las=1;
	void extend(int c){
		int now=++nd, p=las; len[now]=len[p]+1; las=now;
		for(;p&&!ch[p][c];p=lk[p]) ch[p][c]=now;
		if(!p){ lk[now]=1; return; }
		int q=ch[p][c]; if(len[q]==len[p]+1){ lk[now]=q; return; }
		int cl=++nd; len[cl]=len[p]+1; lk[cl]=lk[q]; lk[q]=lk[now]=cl;
		memcpy(ch[cl],ch[q],sizeof(ch[q]));
		for(;p&&ch[p][c]==q; p=lk[p]) ch[p][c]=cl;
	} int trs[N][10];
	void pre_work(){
		static int bin[N], A[N];
		for(int i=1; i<=nd; i++) bin[len[i]]++;
		for(int i=1; i<=n; i++) bin[i]+=bin[i-1];
		for(int i=nd; i>=1; i--) A[bin[len[i]]--]=i;
		for(int i=1; i<=nd; i++)
		for(int c=0; c<10; c++){
			int x=trs[lk[A[i]]][c];
			if(!ch[A[i]][c]) trs[A[i]][c]=x;
			else trs[A[i]][c]=A[i];
		}
	}
	void trans(int &x, int &l, int c){
		if(ch[x][c]){ ++l; x=ch[x][c]; return; }
		x=trs[x][c]; if(!x) x=1,l=0;
		else l=len[x]+1, x=ch[x][c];
	}
}
int dp[M][N][M][2];
int dfs(int u, int nd, int len, bool hv, bool lim){
	if(!u) return hv;
	if(!lim && dp[u][nd][len][hv] != -1) return dp[u][nd][len][hv];
	int up=lim?a[u]:9, as=0, rd=nd, rl=len;
	for(int i=u==d?1:0; i<=up; i++){
		SAM::trans(nd,len,i);
		Add(as,dfs(u-1,nd,len,hv|(len>=d/2),lim&&(i==up)));
		nd=rd; len=rl;
	} if(!lim) dp[u][nd][len][hv]=as; return as;
}
int work(char *S, int dlt){
	int len=d;
	for(int i=1; i<=len; i++) a[i]=S[len-i+1]-'0';
	if(dlt){
		--a[1];
		for(int i=1;a[i]==0&&i<d;i++) a[i]=9, --a[i+1];
		if(a[d]==0) return 0;
	} memset(dp,-1,sizeof(dp));
	return dfs(len,1,0,0,1);
}
int main(){
	#ifdef FSYolanda
	freopen("1.in","r",stdin);
	#endif
	scanf("%s",S+1); n=strlen(S+1);
	for(int i=1; i<=n; i++) SAM::extend(S[i]-'0');
	SAM::pre_work();
	scanf("%s",S+1); d=strlen(S+1); int as=0;
	Dec(as,work(S,1));
	scanf("%s",S+1); d=strlen(S+1);
	Add(as,work(S,0)); cout<<as; return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long ll;
const int N=2007,P=1e9+7,D=57;

int tot,t0,p,q,np,nq,lst,nxt[N][10],link[N],len[N];
void extend(char c){
	int x=c-'0';
	p=lst,np=lst=++tot,len[np]=len[p]+1;
	while(p&&!nxt[p][x])nxt[p][x]=np,p=link[p];
	if(!p)link[np]=t0;
	else{
		q=nxt[p][x];
		if(len[p]+1==len[q])link[np]=q;
		else{
			nq=++tot;
			memcpy(nxt[nq],nxt[q],sizeof(nxt[q]));
			link[nq]=link[q],len[nq]=len[p]+1,link[np]=link[q]=nq;
			while(p&&nxt[p][x]==q)nxt[p][x]=nq,p=link[p];
		}
	}
}

char s[N];
int length,d,arr[N],f[2][D][D][N];
ll x,y;

int dfs(int flag,int zero,int ok,int pos,int mlen,int pts){
	if(!pos)return !zero&&ok;
	if(~f[flag][pos][mlen][pts])return f[flag][pos][mlen][pts];
	int mx=flag?arr[pos]:9,ret=0;
	for(int i=0,x,xlen;i<=mx;++i){
		x=pts,xlen=mlen;
		if((zero&&!i)==0){
			if(nxt[x][i])x=nxt[x][i],++xlen;
			else{
				while(x&&!nxt[x][i])x=link[x];
				if(x)xlen=len[x]+1,x=nxt[x][i];
				else xlen=0,x=t0;
			}
		}
		ret=(ret+dfs(flag&&(i==mx),zero&&!i,ok||(xlen>=d/2),pos-1,xlen,x))%P;
	}
	f[flag][pos][mlen][pts]=ret;
	return ret;
}

int solve(ll n){
	if(!n)return 0;
	int len=0;while(n)arr[++len]=n%10,n/=10;
	memset(f,-1,sizeof(f));
	return dfs(1,1,0,len,0,t0);
}

int main(){
	t0=tot=lst=1;
	scanf("%s%lld%lld",s,&x,&y),length=strlen(s);
	for(int i=0;i<length;++i)extend(s[i]);
	for(ll t=y;t;t/=10)++d;
	printf("%lld\n",(solve(y)-solve(x-1)+P)%P);
	return 0;
}


#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <queue>
#define N 1010
using namespace std;
const int Mod = 1e9 + 7;

inline void inc(int &x, const int &y) {
    x += y; if (x >= Mod) x -= Mod;
}

int n, m, f[2][1001001][2][2][2], len[N];
int ch[1001001][10], fail[1001001], cnt;
char s[N], tx[N], ty[N];

int main() {
#ifdef isLOCAL
    freopen(".in", "r", stdin);
    freopen(".out", "w", stdout);
#endif

    scanf("%s", s + 1);
    n = strlen(s + 1);
    scanf("%s", tx + 1);
    m = strlen(tx + 1);
    scanf("%s", ty + 1);

    for (int i = 1; i <= n; ++i) {
        int rt = 0;
        for (int j = i; j <= n; ++j) {
            int d = s[j] - '0';
            if (!ch[rt][d])
                ch[rt][d] = ++cnt;
            rt = ch[rt][d];
            if (len[rt] < j - i + 1)
                len[rt] = j - i + 1;
        }
    }

    queue<int> q;
    while (!q.empty()) q.pop();
    for (int i = 0; i < 10; ++i) {
        if (!ch[0][i]) ch[0][i] = ++cnt;
        q.push(ch[0][i]);
    }
    while (!q.empty()) {
        int u = q.front(); q.pop();
        if (len[u] < len[fail[u]])
            len[u] = len[fail[u]];
        for (int i = 0; i < 10; ++i) {
            if (!ch[u][i]) ch[u][i] = ch[fail[u]][i];
            else fail[ch[u][i]] = ch[fail[u]][i], q.push(ch[u][i]);
        }
    }

    f[0][0][1][1][0] = 1;
    int o = 0, p = 1;
    for (int i = 1; i <= m; ++i) {
        o ^= 1, p ^= 1;
        for (int j = 0; j <= cnt; ++j)
            for (int x = 0; x < 2; ++x)
                for (int y = 0; y < 2; ++y)
                    for (int z = 0; z < 2; ++z) {
                        int &t = f[p][j][x][y][z];
                        if (!t) continue;
                        int l = tx[i] - '0', r = ty[i] - '0';
//                        cout << i << " " << j << " " << x << " " << y << " " << z << endl;
//                        cout << l << " " << r << " " << ch[0][1] << endl;
                        for (int w = (x ? l : 0); w <= (y ? r : 9); ++w)
                            if (ch[j][w])
                                inc(f[o][ch[j][w]][x && (w == l)][y && (w == r)][z || len[ch[j][w]] >= m / 2], t);
                        t = 0;
                    }
    }

    int ans = 0;
    for (int i = 0; i <= cnt; ++i)
        for (int x = 0; x < 2; ++x)
            for (int y = 0; y < 2; ++y)
                inc(ans, f[o][i][x][y][1]);
    cout << ans << endl;

    return 0;
}


#include<cstdio>
#include<cstring>
using namespace std;
const int maxn=1005,maxd=55,B=10,M=1000000007;
int n,d,hd;
char s[maxn],a[maxd],b[maxd];
int nex[maxn*maxd][B],ap[maxn*maxd],root,tot;
int f[maxd][maxn*maxd][2][2][2];
void Insert(char *b,char *e)
{
	int p=root;
	for(;b<e;b++)
	{
		if(!nex[p][*b-'0'])nex[p][*b-'0']=++tot;
		p=nex[p][*b-'0'];
	}
	ap[p]=1;
}

void init()
{
	scanf("%s",s+1);
	n=strlen(s+1);
	scanf("%s",a+1);
	scanf("%s",b+1);
	d=strlen(a+1);hd=d>>1;
	for(int i=1;i+hd-1<=n;i++)
		Insert(s+i,s+i+hd);
	memset(f,-1,sizeof(f));
}

int dp(int x,int p,int sx,int sy,int ha)
{
	if(x>d)
		return ha;
	int &r=f[x][p][sx][sy][ha];
	if(~r)return r;
	r=0;
	for(int k=0,p_,sx_,sy_,ha_;k<B;k++)
	{
		if(k<a[x]-'0'&&!sx||k>b[x]-'0'&&!sy)continue;
		sx_=sx|(k>a[x]-'0');
		sy_=sy|(k<b[x]-'0');
		p_=nex[p][k];
		ha_=ha|ap[p_];
		r+=dp(x+1,p_,sx_,sy_,ha_);
		if(r>=M)r-=M;
	}
	return r;
}

int main()
{
	init();
	printf("%d\n",dp(1,0,0,0,0));
	return 0;
}


#include<cstdio>
#include<cstring>
using namespace std;
const int maxn=1005,maxd=55,B=10,M=1000000007;
int n,d,hd;
char s[maxn],a[maxd],b[maxd];
int nex[maxn*maxd][B],fail[maxn*maxd],ap[maxn*maxd],root,tot;
int f[maxd][maxn*maxd][2][2][2];
void Insert(char *b,char *e)
{
	int p=root;
	for(;b<e;b++)
	{
		if(!nex[p][*b-'0'])nex[p][*b-'0']=++tot;
		p=nex[p][*b-'0'];
	}
	ap[p]=1;
}

void init()
{
	root=tot=1;
	scanf("%s",s+1);
	n=strlen(s+1);
	scanf("%s",a+1);
	scanf("%s",b+1);
	d=strlen(a+1);hd=d+1>>1;
	for(int i=1;i+hd-1<=n;i++)
		Insert(s+i,s+i+hd);
	memset(f,-1,sizeof(f));
}

int q[maxn*maxd],qh,qt;

void build_ac()
{
	q[++qt]=root;
	for(int p,t,i;qh<qt;)
	{
		p=q[++qh];
		for(i=0;i<B;i++)
			if(nex[p][i])
			{
				for(t=fail[p];t;t=fail[t])
					if(nex[t][i])break;
				fail[nex[p][i]]=t?nex[t][i]:root;
				q[++qt]=nex[p][i];
			}
			else
			{
				for(t=fail[p];t;t=fail[t])
					if(nex[t][i])break;
				nex[p][i]=t?nex[t][i]:root;
			}
	}
}

int dp(int x,int p,int sx,int sy,int ha)
{
	if(x>d)
		return ha;
	int &r=f[x][p][sx][sy][ha];
	if(~r)return r;
	r=0;
	for(int k=0,p_,sx_,sy_,ha_;k<B;k++)
	{
		if(k<a[x]-'0'&&!sx||k>b[x]-'0'&&!sy)continue;
		sx_=sx|(k>a[x]-'0');
		sy_=sy|(k<b[x]-'0');
		p_=nex[p][k];
		ha_=ha|ap[p_];
		r+=dp(x+1,p_,sx_,sy_,ha_);
		if(r>=M)r-=M;
	}
	return r;
}

int main()
{
	init();
	build_ac();
	printf("%d\n",dp(1,1,0,0,0));
	return 0;
}


#include<cstdio>
#include<cstring>
using namespace std;
const int maxn=1005,maxd=55,B=10,M=1000000007;
int n,d,hd;
char s[maxn],a[maxd],b[maxd];
int nex[maxn*maxd][B],fail[maxn*maxd],ap[maxn*maxd],root,tot;
int f[maxd][maxn*maxd][2][2][2];
void Insert(char *b,char *e)
{
	int p=root;
	for(;b<e;b++)
	{
		if(!nex[p][*b-'0'])nex[p][*b-'0']=++tot;
		p=nex[p][*b-'0'];
	}
	ap[p]=1;
}

void init()
{
	root=tot=1;
	scanf("%s",s+1);
	n=strlen(s+1);
	scanf("%s",a+1);
	scanf("%s",b+1);
	d=strlen(a+1);hd=d>>1;
	for(int i=1;i+hd-1<=n;i++)
		Insert(s+i,s+i+hd);
	memset(f,-1,sizeof(f));
}

int q[maxn*maxd],qh,qt;

void build_ac()
{
	q[++qt]=root;
	for(int p,t,i;qh<qt;)
	{
		p=q[++qh];
		for(i=0;i<B;i++)
			if(nex[p][i])
			{
				for(t=fail[p];t;t=fail[t])
					if(nex[t][i])break;
				fail[nex[p][i]]=t?nex[t][i]:root;
				if(t)ap[nex[p][i]]|=ap[nex[t][i]];
				q[++qt]=nex[p][i];
			}
			else nex[p][i]=p==root?root:nex[fail[p]][i];
	}
}

int dp(int x,int p,int sx,int sy,int ha)
{
	if(x>d)
		return ha;
	int &r=f[x][p][sx][sy][ha];
	if(~r)return r;
	r=0;
	for(int k=0,p_,sx_,sy_,ha_;k<B;k++)
	{
		if(k<a[x]-'0'&&!sx||k>b[x]-'0'&&!sy)continue;
		sx_=sx|(k>a[x]-'0');
		sy_=sy|(k<b[x]-'0');
		p_=nex[p][k];
		ha_=ha|ap[p_];
		r+=dp(x+1,p_,sx_,sy_,ha_);
		if(r>=M)r-=M;
	}
	return r;
}

int main()
{
	init();
	build_ac();
	printf("%d\n",dp(1,1,0,0,0));
	return 0;
}


/// *********************************************** K
/// B *                                           * H
/// I *    Solved By : Bir Bahadur Khatri(B'ru)   * A
/// R *      Be Positive,be Happy.                * T
/// U *                                           * R
/// *********************************************** I

#include<bits/stdc++.h>

#define LL long long int
#define ULL unsigned LL
#define PI 2.0*acos(0.0)
#define D double
#define sz size()
#define PB push_back
#define cp printf("***** here here here here *****\n");
#define NL printf("\n")
#define CHR getchar()
#define SQR(n) (n*n)
#define xx first
#define yy second
#define MEM(a,val) memset(a,val,sizeof(a))
#define Max(a,b) ((a>b)?a:b)
#define Min(a,b) ((a<b)?a:b)
#define _Max(a,b,c) Max(a,Max(b,c))
#define _Min(a,b,c) Min(a,Min(b,c))
#define S1(a) a=in<int>()
#define S2(a,b) a=in<int>(),b=in<int>()
#define S3(a,b,c) a=in<int>(),b=in<int>(),c=in<int>()
#define SL1(a) a=in<LL>()
#define SL2(a,b) a=in<LL>(),b=in<LL>()
#define SL3(a,b,c) a=in<LL>(),b=in<LL>(),c=in<LL>()
#define F(i,a,b) for(int i=a;i<b; i++)
#define R(i,a,b) for(int i=a-1;i>=b; i--)
#define all(a) a.begin(),a.end()
#define BitCnt(a) __builtin_popcountll(a)
#define InpOut freopen("A.in","r",stdin),freopen("A1.out","w",stdout)
#include <time.h>

using namespace std;
template <typename T> T in(){char ch;T n = 0;bool ng = false;while (1){ch = getchar();if (ch == '-'){ng = true;ch = getchar();break;}if (ch>='0' && ch<='9')     break;}while (1){n = n*10 + (ch - '0');ch = getchar();if (ch<'0' || ch>'9')   break;}return (ng?-n:n);}
template<typename T>inline T Dist(T x1,T y1,T x2, T y2){return sqrt( SQR(x1-x2) + SQR(y1-y2) );}
template<typename T>inline T POW(T B,T P){ if(P==0) return 1; if(P&1) return B*POW(B,P-1);  else return SQR(POW(B,P/2));}
template<typename T>inline T ABS(T a) {if(a<0)return -a;else return a;}
template<typename T>inline T Gcd(T a,T b){if(a<0)return Gcd(-a,b);if(b<0)return Gcd(a,-b);return (b==0)?a:Gcd(b,a%b);}
template<typename T>inline T Lcm(T a,T b) {if(a<0)return Lcm(-a,b);if(b<0)return Lcm(a,-b);return a*(b/Gcd(a,b));}
long long Bigmod(long long base, long long power, long long MOD){long long ret=1;while(power){if(power & 1)ret=(ret*base)%MOD;base=(base*base)%MOD;power>>=1;}return ret;}
long long ModInverse(long long number, long long MOD){return Bigmod(number, MOD-2, MOD);}
int Set(int N,int pos){ return N=N | (1<<pos);}
int Reset(int N,int pos){return N= N & ~(1<<pos);}
bool Chkbit(int N,int pos){return (bool)(N & (1<<pos));}
bool isVowel(char ch){ ch=toupper(ch); if(ch=='A'||ch=='U'||ch=='I'||ch=='O'||ch=='E') return true; return false;}
bool isConst(char ch){if (isalpha(ch) && !isVowel(ch)) return true; return false;}
int toInt(string s)  { int sm; stringstream ss(s); ss>>sm; return sm; }
long long int toLlint(string s) { long long int sm; stringstream ss(s); ss>>sm; return sm;}

///**********************************************************//

///         0123456789
#define MX  1000007
#define MOD 1000000007
#define INF 100000000
/// ==========================================////

char s[1002];
int n,d;

char a[102],b[102];

struct Nd
{
    int Fl,Fq,E[11];
    Nd() {
        Fl=Fq=0;
        MEM(E,0);
    }
};

Nd Tree[MX];

int avail,Ln[MX];

void In(int l,int r)
{
    int pos=1,Ll=0;
    for(int i=l;i<=r;i++) {
        if(Tree[pos].E[ s[i]-'0' ]==0) {
            Tree[pos].E[ s[i]-'0' ]=++avail;
            Tree[avail]=Nd();
        }
        Ll++;
        pos=Tree[pos].E[ s[i]-'0' ];
        Ln[ pos ]=Ll;
    }
    return;
}

void Fail()
{
    queue<int> q; q.push(1);
    for(int i=0;i<10;i++) {
        Tree[0].E[ i ]=1;
    }
    Tree[1].Fl=0;

    while(q.sz) {
        int u=q.front(); q.pop();

        for(int i=0;i<10;i++) {
            if(Tree[u].E[i]) {
                Tree[ Tree[u].E[i] ].Fl=Tree[ Tree[u].Fl ].E[ i ];
                q.push( Tree[u].E[i] );
            }
            else {
                Tree[ u ].E[i]=Tree[ Tree[u].Fl ].E[i];
            }
        }
    }
    return;
}

LL dp[25009][55][2][2][2];

LL Solve(int node,int pos,int ch,int ch1,int ok)
{
    //cout<<node<< " "<<pos<<  " "<<ch<< " "<<ok<<endl;
    if(pos==d) return ok;

    LL &res=dp[node][pos][ch][ch1][ok];
    if(res!=-1) return res;

    res=0;

    int l=(a[pos]-'0');
    int h=(b[pos]-'0');
    if(ch) {
        h=9;
    }
    if(ch1) {
        l=0;
    }

    for(int i=l;i<=h;i++) {
        int Nid=Tree[node].E[i];
        res=(res+Solve(Nid,pos+1,ch|(i<h),ch1|(i>l),ok|(Ln[Nid]>=d/2)))%MOD;
    }
    return res;
}

int main()
{
    Tree[1]=Nd();
    avail=1;
    scanf("%s",&s);
    scanf("%s%s",&a,&b);
    n=strlen(s);
    d=strlen(a);
    for(int i=0;i+d/2-1<n;i++) {
        In(i,i+d/2-1);
    }
    Fail();

    MEM(dp,-1);
    printf("%lld\n",Solve(1,0,0,0,0));
    return 0;
}


/// *********************************************** K
/// B *                                           * H
/// I *    Solved By : Bir Bahadur Khatri(B'ru)   * A
/// R *      Be Positive,be Happy.                * T
/// U *                                           * R
/// *********************************************** I

#include<bits/stdc++.h>

#define LL long long int
#define ULL unsigned LL
#define PI 2.0*acos(0.0)
#define D double
#define sz size()
#define PB push_back
#define cp printf("***** here here here here *****\n");
#define NL printf("\n")
#define CHR getchar()
#define SQR(n) (n*n)
#define xx first
#define yy second
#define MEM(a,val) memset(a,val,sizeof(a))
#define Max(a,b) ((a>b)?a:b)
#define Min(a,b) ((a<b)?a:b)
#define _Max(a,b,c) Max(a,Max(b,c))
#define _Min(a,b,c) Min(a,Min(b,c))
#define S1(a) a=in<int>()
#define S2(a,b) a=in<int>(),b=in<int>()
#define S3(a,b,c) a=in<int>(),b=in<int>(),c=in<int>()
#define SL1(a) a=in<LL>()
#define SL2(a,b) a=in<LL>(),b=in<LL>()
#define SL3(a,b,c) a=in<LL>(),b=in<LL>(),c=in<LL>()
#define F(i,a,b) for(int i=a;i<b; i++)
#define R(i,a,b) for(int i=a-1;i>=b; i--)
#define all(a) a.begin(),a.end()
#define BitCnt(a) __builtin_popcountll(a)
#define InpOut freopen("A.in","r",stdin),freopen("A1.out","w",stdout)
#include <time.h>

using namespace std;
template <typename T> T in(){char ch;T n = 0;bool ng = false;while (1){ch = getchar();if (ch == '-'){ng = true;ch = getchar();break;}if (ch>='0' && ch<='9')     break;}while (1){n = n*10 + (ch - '0');ch = getchar();if (ch<'0' || ch>'9')   break;}return (ng?-n:n);}
template<typename T>inline T Dist(T x1,T y1,T x2, T y2){return sqrt( SQR(x1-x2) + SQR(y1-y2) );}
template<typename T>inline T POW(T B,T P){ if(P==0) return 1; if(P&1) return B*POW(B,P-1);  else return SQR(POW(B,P/2));}
template<typename T>inline T ABS(T a) {if(a<0)return -a;else return a;}
template<typename T>inline T Gcd(T a,T b){if(a<0)return Gcd(-a,b);if(b<0)return Gcd(a,-b);return (b==0)?a:Gcd(b,a%b);}
template<typename T>inline T Lcm(T a,T b) {if(a<0)return Lcm(-a,b);if(b<0)return Lcm(a,-b);return a*(b/Gcd(a,b));}
long long Bigmod(long long base, long long power, long long MOD){long long ret=1;while(power){if(power & 1)ret=(ret*base)%MOD;base=(base*base)%MOD;power>>=1;}return ret;}
long long ModInverse(long long number, long long MOD){return Bigmod(number, MOD-2, MOD);}
int Set(int N,int pos){ return N=N | (1<<pos);}
int Reset(int N,int pos){return N= N & ~(1<<pos);}
bool Chkbit(int N,int pos){return (bool)(N & (1<<pos));}
bool isVowel(char ch){ ch=toupper(ch); if(ch=='A'||ch=='U'||ch=='I'||ch=='O'||ch=='E') return true; return false;}
bool isConst(char ch){if (isalpha(ch) && !isVowel(ch)) return true; return false;}
int toInt(string s)  { int sm; stringstream ss(s); ss>>sm; return sm; }
long long int toLlint(string s) { long long int sm; stringstream ss(s); ss>>sm; return sm;}

///**********************************************************//

///         0123456789
#define MX  1000007
#define MOD 1000000007
#define INF 100000000
/// ==========================================////

char s[1002];
int n,d;

char a[102],b[102];

struct Nd
{
    int Fl,Fq,E[11];
    Nd() {
        Fl=Fq=0;
        MEM(E,0);
    }
};

Nd Tree[MX];

int avail,Ln[MX];

void In(int l,int r)
{
    int pos=1,Ll=0;
    for(int i=l;i<=r;i++) {
        if(Tree[pos].E[ s[i]-'0' ]==0) {
            Tree[pos].E[ s[i]-'0' ]=++avail;
            Tree[avail]=Nd();
        }
        Ll++;
        pos=Tree[pos].E[ s[i]-'0' ];
        Ln[ pos ]=Ll;
    }
    return;
}

void Fail()
{
    queue<int> q; q.push(1);
    for(int i=0;i<10;i++) {
        Tree[0].E[ i ]=1;
    }
    Tree[1].Fl=0;

    while(q.sz) {
        int u=q.front(); q.pop();

        for(int i=0;i<10;i++) {
            if(Tree[u].E[i]) {
                Tree[ Tree[u].E[i] ].Fl=Tree[ Tree[u].Fl ].E[ i ];
                q.push( Tree[u].E[i] );
            }
            else {
                Tree[ u ].E[i]=Tree[ Tree[u].Fl ].E[i];
            }
        }
    }
    return;
}

int dp[25009][55][2][2][2];

int Solve(int node,int pos,int ch,int ch1,int ok)
{
    if(pos==d) return ok;

    int &res=dp[node][pos][ch][ch1][ok];
    if(res!=-1) return res;

    res=0;

    int l=(a[pos]-'0');
    int h=(b[pos]-'0');
    if(ch) {
        h=9;
    }
    if(ch1) {
        l=0;
    }

    for(int i=l;i<=h;i++) {
        int Nid=Tree[node].E[i];
        res=(res+Solve(Nid,pos+1,ch|(i<h),ch1|(i>l),ok|(Ln[Nid]>=d/2)))%MOD;
    }
    return res;
}

int main()
{
    Tree[1]=Nd();
    avail=1;
    scanf("%s",&s);
    scanf("%s%s",&a,&b);
    n=strlen(s);
    d=strlen(a);
    for(int i=0;i+d/2-1<n;i++) {
        In(i,i+d/2-1);
    }
    Fail();

    MEM(dp,-1);
    printf("%d\n",Solve(1,0,0,0,0));
    return 0;
}


/// *********************************************** K
/// B *                                           * H
/// I *    Solved By : Bir Bahadur Khatri(B'ru)   * A
/// R *      Be Positive,be Happy.                * T
/// U *                                           * R
/// *********************************************** I

#include<bits/stdc++.h>

#define LL long long int
#define ULL unsigned LL
#define PI 2.0*acos(0.0)
#define D double
#define sz size()
#define PB push_back
#define cp printf("***** here here here here *****\n");
#define NL printf("\n")
#define CHR getchar()
#define SQR(n) (n*n)
#define xx first
#define yy second
#define MEM(a,val) memset(a,val,sizeof(a))
#define Max(a,b) ((a>b)?a:b)
#define Min(a,b) ((a<b)?a:b)
#define _Max(a,b,c) Max(a,Max(b,c))
#define _Min(a,b,c) Min(a,Min(b,c))
#define S1(a) a=in<int>()
#define S2(a,b) a=in<int>(),b=in<int>()
#define S3(a,b,c) a=in<int>(),b=in<int>(),c=in<int>()
#define SL1(a) a=in<LL>()
#define SL2(a,b) a=in<LL>(),b=in<LL>()
#define SL3(a,b,c) a=in<LL>(),b=in<LL>(),c=in<LL>()
#define F(i,a,b) for(int i=a;i<b; i++)
#define R(i,a,b) for(int i=a-1;i>=b; i--)
#define all(a) a.begin(),a.end()
#define BitCnt(a) __builtin_popcountll(a)
#define InpOut freopen("A.in","r",stdin),freopen("A1.out","w",stdout)
#include <time.h>

using namespace std;
template <typename T> T in(){char ch;T n = 0;bool ng = false;while (1){ch = getchar();if (ch == '-'){ng = true;ch = getchar();break;}if (ch>='0' && ch<='9')     break;}while (1){n = n*10 + (ch - '0');ch = getchar();if (ch<'0' || ch>'9')   break;}return (ng?-n:n);}
template<typename T>inline T Dist(T x1,T y1,T x2, T y2){return sqrt( SQR(x1-x2) + SQR(y1-y2) );}
template<typename T>inline T POW(T B,T P){ if(P==0) return 1; if(P&1) return B*POW(B,P-1);  else return SQR(POW(B,P/2));}
template<typename T>inline T ABS(T a) {if(a<0)return -a;else return a;}
template<typename T>inline T Gcd(T a,T b){if(a<0)return Gcd(-a,b);if(b<0)return Gcd(a,-b);return (b==0)?a:Gcd(b,a%b);}
template<typename T>inline T Lcm(T a,T b) {if(a<0)return Lcm(-a,b);if(b<0)return Lcm(a,-b);return a*(b/Gcd(a,b));}
long long Bigmod(long long base, long long power, long long MOD){long long ret=1;while(power){if(power & 1)ret=(ret*base)%MOD;base=(base*base)%MOD;power>>=1;}return ret;}
long long ModInverse(long long number, long long MOD){return Bigmod(number, MOD-2, MOD);}
int Set(int N,int pos){ return N=N | (1<<pos);}
int Reset(int N,int pos){return N= N & ~(1<<pos);}
bool Chkbit(int N,int pos){return (bool)(N & (1<<pos));}
bool isVowel(char ch){ ch=toupper(ch); if(ch=='A'||ch=='U'||ch=='I'||ch=='O'||ch=='E') return true; return false;}
bool isConst(char ch){if (isalpha(ch) && !isVowel(ch)) return true; return false;}
int toInt(string s)  { int sm; stringstream ss(s); ss>>sm; return sm; }
long long int toLlint(string s) { long long int sm; stringstream ss(s); ss>>sm; return sm;}

///**********************************************************//

///         0123456789
#define MX  1000007
#define MOD 1000000007
#define INF 100000000
/// ==========================================////

char s[1002];
int n,d;

char a[102],b[102];

struct Nd
{
    int Fl,Fq,E[11];
    Nd() {
        Fl=Fq=0;
        MEM(E,0);
    }
};

Nd Tree[MX];

int avail,Ln[MX];

void In(int l,int r)
{
    int pos=1,Ll=0;
    for(int i=l;i<=r;i++) {
        if(Tree[pos].E[ s[i]-'0' ]==0) {
            Tree[pos].E[ s[i]-'0' ]=++avail;
            Tree[avail]=Nd();
        }
        Ll++;
        pos=Tree[pos].E[ s[i]-'0' ];
        Ln[ pos ]=Ll;
    }
    return;
}

void Fail()
{
    queue<int> q; q.push(1);
    for(int i=0;i<10;i++) {
        Tree[0].E[ i ]=1;
    }
    Tree[1].Fl=0;

    while(q.sz) {
        int u=q.front(); q.pop();

        for(int i=0;i<10;i++) {
            if(Tree[u].E[i]) {
                Tree[ Tree[u].E[i] ].Fl=Tree[ Tree[u].Fl ].E[ i ];
                q.push( Tree[u].E[i] );
            }
            else {
                Tree[ u ].E[i]=Tree[ Tree[u].Fl ].E[i];
            }
        }
    }
    return;
}

LL dp[25009][55][2][2];

LL Solve(int node,int pos,int ch,int ok)
{
    if(pos==d) return ok;

    LL &res=dp[node][pos][ch][ok];
    if(res!=-1) return res;

    res=0;

    int l=(a[pos]-'0');
    int h=(b[pos]-'0');
    if(ch) {
        l=0,h=9;
    }

    for(int i=l;i<=h;i++) {
        int Nid=Tree[node].E[i];
        res=(res+Solve(Nid,pos+1,ch|(i<l),ok|(Ln[Nid]>=d/2)))%MOD;
    }
    return res;
}

int main()
{
    Tree[1]=Nd();
    avail=1;
    scanf("%s",&s);
    scanf("%s%s",&a,&b);
    n=strlen(s);
    d=strlen(a);
    for(int i=0;i+d/2-1<n;i++) {
        In(i,i+d/2-1);
    }
    Fail();

    MEM(dp,-1);
    printf("%lld\n",Solve(1,0,0,0));
    return 0;
}


/// *********************************************** K
/// B *                                           * H
/// I *    Solved By : Bir Bahadur Khatri(B'ru)   * A
/// R *      Be Positive,be Happy.                * T
/// U *                                           * R
/// *********************************************** I

#include<bits/stdc++.h>

#define LL long long int
#define ULL unsigned LL
#define PI 2.0*acos(0.0)
#define D double
#define sz size()
#define PB push_back
#define cp printf("***** here here here here *****\n");
#define NL printf("\n")
#define CHR getchar()
#define SQR(n) (n*n)
#define xx first
#define yy second
#define MEM(a,val) memset(a,val,sizeof(a))
#define Max(a,b) ((a>b)?a:b)
#define Min(a,b) ((a<b)?a:b)
#define _Max(a,b,c) Max(a,Max(b,c))
#define _Min(a,b,c) Min(a,Min(b,c))
#define S1(a) a=in<int>()
#define S2(a,b) a=in<int>(),b=in<int>()
#define S3(a,b,c) a=in<int>(),b=in<int>(),c=in<int>()
#define SL1(a) a=in<LL>()
#define SL2(a,b) a=in<LL>(),b=in<LL>()
#define SL3(a,b,c) a=in<LL>(),b=in<LL>(),c=in<LL>()
#define F(i,a,b) for(int i=a;i<b; i++)
#define R(i,a,b) for(int i=a-1;i>=b; i--)
#define all(a) a.begin(),a.end()
#define BitCnt(a) __builtin_popcountll(a)
#define InpOut freopen("A.in","r",stdin),freopen("A1.out","w",stdout)
#include <time.h>

using namespace std;
template <typename T> T in(){char ch;T n = 0;bool ng = false;while (1){ch = getchar();if (ch == '-'){ng = true;ch = getchar();break;}if (ch>='0' && ch<='9')     break;}while (1){n = n*10 + (ch - '0');ch = getchar();if (ch<'0' || ch>'9')   break;}return (ng?-n:n);}
template<typename T>inline T Dist(T x1,T y1,T x2, T y2){return sqrt( SQR(x1-x2) + SQR(y1-y2) );}
template<typename T>inline T POW(T B,T P){ if(P==0) return 1; if(P&1) return B*POW(B,P-1);  else return SQR(POW(B,P/2));}
template<typename T>inline T ABS(T a) {if(a<0)return -a;else return a;}
template<typename T>inline T Gcd(T a,T b){if(a<0)return Gcd(-a,b);if(b<0)return Gcd(a,-b);return (b==0)?a:Gcd(b,a%b);}
template<typename T>inline T Lcm(T a,T b) {if(a<0)return Lcm(-a,b);if(b<0)return Lcm(a,-b);return a*(b/Gcd(a,b));}
long long Bigmod(long long base, long long power, long long MOD){long long ret=1;while(power){if(power & 1)ret=(ret*base)%MOD;base=(base*base)%MOD;power>>=1;}return ret;}
long long ModInverse(long long number, long long MOD){return Bigmod(number, MOD-2, MOD);}
int Set(int N,int pos){ return N=N | (1<<pos);}
int Reset(int N,int pos){return N= N & ~(1<<pos);}
bool Chkbit(int N,int pos){return (bool)(N & (1<<pos));}
bool isVowel(char ch){ ch=toupper(ch); if(ch=='A'||ch=='U'||ch=='I'||ch=='O'||ch=='E') return true; return false;}
bool isConst(char ch){if (isalpha(ch) && !isVowel(ch)) return true; return false;}
int toInt(string s)  { int sm; stringstream ss(s); ss>>sm; return sm; }
long long int toLlint(string s) { long long int sm; stringstream ss(s); ss>>sm; return sm;}

///**********************************************************//

///         0123456789
#define MX  1000007
#define MOD 1000000007
#define INF 100000000
/// ==========================================////

char s[1002];
int n,d;

char a[102],b[102];

struct Nd
{
    int Fl,Fq,E[11];
    Nd() {
        Fl=Fq=0;
        MEM(E,0);
    }
};

Nd Tree[MX];

int avail,Ln[MX];

void In(int l,int r)
{
    int pos=1,Ll=0;
    for(int i=l;i<=r;i++) {
        if(Tree[pos].E[ s[i]-'0' ]==0) {
            Tree[pos].E[ s[i]-'0' ]=++avail;
            Tree[avail]=Nd();
        }
        Ll++;
        pos=Tree[pos].E[ s[i]-'0' ];
        Ln[ pos ]=Ll;
    }
    return;
}

void Fail()
{
    queue<int> q; q.push(1);
    for(int i=0;i<10;i++) {
        Tree[0].E[ i ]=1;
    }
    Tree[1].Fl=0;

    while(q.sz) {
        int u=q.front(); q.pop();

        for(int i=0;i<10;i++) {
            if(Tree[u].E[i]) {
                Tree[ Tree[u].E[i] ].Fl=Tree[ Tree[u].Fl ].E[ i ];
                q.push( Tree[u].E[i] );
            }
            else {
                Tree[ u ].E[i]=Tree[ Tree[u].Fl ].E[i];
            }
        }
    }
    return;
}

LL dp[25009][55][2][2];

LL Solve(int node,int pos,int ch,int ok)
{
    if(pos==d) return ok;

    LL &res=dp[node][pos][ch][ok];
    if(res!=-1) return res;

    res=0;

    int l=(a[pos]-'0');
    int h=(b[pos]-'0');
    if(ch) {
        l=0,h=9;
    }

    for(int i=l;i<=h;i++) {
        int Nid=Tree[node].E[i];
        if(Nid) {
            res=(res+Solve(Nid,pos+1,ch|(i<l),ok|(Ln[Nid]>=d/2)))%MOD;
        }
        else {
            Nid=Tree[Nid].Fl;
            res=(res+Solve(Nid,pos+1,ch|(i<l),ok|(Ln[Nid]>=d/2)))%MOD;
        }
    }
    return res;
}

int main()
{
    Tree[1]=Nd();
    avail=1;
    scanf("%s",&s);
    scanf("%s%s",&a,&b);
    n=strlen(s);
    d=strlen(a);
    for(int i=0;i+d/2<n;i++) {
        In(i,i+d/2-1);
    }
    Fail();

    MEM(dp,-1);
    printf("%lld\n",Solve(1,0,0,0));
    return 0;
}


#include<bits/stdc++.h>
#define R register
#define int long long
using namespace std;

inline int read() {
	int res=0,f=1;char ch;
	while(!isdigit(ch=getchar())) if(ch=='-') f=-1;
	do {
		res=res*10+ch-'0';
	} while(isdigit(ch=getchar()));
	return res*f;
}

const int N=1e3+5,M=55,P=1e9+7;

int ch[N*N/4][10],fail[N*N/4],tot,n;
bool ed[N*N/4];

char s[N],a[M],b[M];

inline void insert(int l,int r) {
	int u=0;
	for(R int i=l ; i<r ; ++i) {
		int c=s[i]-'0';
		if(!ch[u][c]) ch[u][c]=++tot;
		u=ch[u][c];
	}
	ed[u]=1;
}

inline void bfs() {
	queue <int> q;
	for(R int i=0 ; i<10 ; ++i) if(ch[0][i]) q.push(ch[0][i]);
	while(!q.empty()) {
		int u=q.front();q.pop();
		for(R int i=0 ; i<10 ; ++i) {
			if(ch[u][i]) fail[ch[u][i]]=ch[fail[u]][i],q.push(ch[u][i]);
			else ch[u][i]=ch[fail[u]][i];
		}
	}
}

int f[M][2],dp[M][N*N/4][2],d;

inline int calc(char *s) {
	int ans=0;
	f[d+1][0]=f[d+1][1]=1;
	for(R int i=d ; i ; --i) f[i][0]=f[i+1][0]*10,f[i][1]=f[i+1][1]+f[i+1][0]*(s[i]-'0');
	for(R int i=1 ; i<=d ; ++i)
		for(R int j=0 ; j<=tot ; ++j)
			for(R int k=0 ; k<2 ; ++k)
				dp[i][j][k]=0;
	dp[0][0][1]=1;
	for(R int i=0 ; i<d ; ++i)
		for(R int j=0 ; j<=tot ; ++j)
			if(!ed[j]) {
				for(R int k=0 ; k<10 ; ++k) {
					int c=ch[j][k];
					(dp[i+1][c][0]+=dp[i][j][0])%=P;
					if(k<s[i+1]-'0') (dp[i+1][c][0]+=dp[i][j][1])%=P;
					if(k==s[i+1]-'0') (dp[i+1][c][1]+=dp[i][j][1])%=P;
				}
			}
	for(R int i=1 ; i<=d ; ++i)
		for(R int j=0 ; j<=tot ; ++j)
			if(ed[j]) (ans+=dp[i][j][0]*f[i+1][0]+dp[i][j][1]*f[i+1][1])%=P;
	return ans;
}

signed main() {
	scanf("%s",s+1);
	n=strlen(s+1);
	scanf("%s",a+1),scanf("%s",b+1);
	d=strlen(a+1);
	for(R int i=1 ; i+d/2-1<=n ; ++i) insert(i,i+d/2);
	bfs();
	int w=d;
	while(a[w]=='0') a[w--]='9';
	--a[w];
	printf("%lld",(calc(b)-calc(a)+P)%P);
	return 0;
}


#include<bits/stdc++.h>
#define R register
#define int long long
using namespace std;

inline int read() {
	int res=0,f=1;char ch;
	while(!isdigit(ch=getchar())) if(ch=='-') f=-1;
	do {
		res=res*10+ch-'0';
	} while(isdigit(ch=getchar()));
	return res*f;
}

const int N=1e3+5,M=55,P=1e9+7;

int ch[N*N/4][10],fail[N*N/4],tot,n;
bool ed[N*N/4];

char s[N],a[M],b[M];

inline void insert(int l,int r) {
	int u=0;
	for(R int i=l ; i<r ; ++i) {
		int c=s[i]-'0';
		if(!ch[u][c]) ch[u][c]=++tot;
		u=ch[u][c];
	}
	ed[u]=1;
}

inline void bfs() {
	queue <int> q;
	for(R int i=0 ; i<10 ; ++i) if(ch[0][i]) q.push(ch[0][i]);
	while(!q.empty()) {
		int u=q.front();q.pop();
		for(R int i=0 ; i<10 ; ++i) {
			if(ch[u][i]) fail[ch[u][i]]=ch[fail[u]][i],q.push(ch[u][i]);
			else ch[u][i]=ch[fail[u]][i];
		}
	}
}

int f[M][2],dp[M][N*N/4][2],d;

inline int calc(char *s) {
	int ans=0;
	f[d+1][0]=f[d+1][1]=1;
	for(R int i=d ; i ; --i) f[i][0]=f[i+1][0]*10%P,f[i][1]=(f[i+1][1]+f[i+1][0]*(s[i]-'0'))%P;
	for(R int i=1 ; i<=d ; ++i)
		for(R int j=0 ; j<=tot ; ++j)
			for(R int k=0 ; k<2 ; ++k)
				dp[i][j][k]=0;
	dp[0][0][1]=1;
	for(R int i=0 ; i<d ; ++i)
		for(R int j=0 ; j<=tot ; ++j)
			if(!ed[j]) {
				for(R int k=0 ; k<10 ; ++k) {
					int c=ch[j][k];
					(dp[i+1][c][0]+=dp[i][j][0])%=P;
					if(k<s[i+1]-'0') (dp[i+1][c][0]+=dp[i][j][1])%=P;
					if(k==s[i+1]-'0') (dp[i+1][c][1]+=dp[i][j][1])%=P;
				}
			}
	for(R int i=1 ; i<=d ; ++i)
		for(R int j=0 ; j<=tot ; ++j)
			if(ed[j]) (ans+=dp[i][j][0]*f[i+1][0]%P+dp[i][j][1]*f[i+1][1]%P)%=P;
	return ans;
}

signed main() {
	scanf("%s",s+1);
	n=strlen(s+1);
	scanf("%s",a+1),scanf("%s",b+1);
	d=strlen(a+1);
	for(R int i=1 ; i+d/2-1<=n ; ++i) insert(i,i+d/2);
	bfs();
	int w=d;
	while(a[w]=='0') a[w--]='9';
	--a[w];
	printf("%lld",(calc(b)-calc(a)+P)%P);
	return 0;
}


#include<bits/stdc++.h>
#define R register
#define int long long
using namespace std;

inline int read() {
	int res=0,f=1;char ch;
	while(!isdigit(ch=getchar())) if(ch=='-') f=-1;
	do {
		res=res*10+ch-'0';
	} while(isdigit(ch=getchar()));
	return res*f;
}

const int N=1e3+5,M=55,P=1e9+7;

int ch[N*N/2][10],fail[N*N/2],tot,n;
bool ed[N*N/2];

char s[N],a[M],b[M];

inline void insert(int l,int r) {
	int u=0;
	for(R int i=l ; i<r ; ++i) {
		int c=s[i]-'0';
		if(!ch[u][c]) ch[u][c]=++tot;
		u=ch[u][c];
	}
	ed[u]=1;
}

inline void bfs() {
	queue <int> q;
	for(R int i=0 ; i<10 ; ++i) if(ch[0][i]) q.push(ch[0][i]);
	while(!q.empty()) {
		int u=q.front();q.pop();
		for(R int i=0 ; i<10 ; ++i) {
			if(ch[u][i]) fail[ch[u][i]]=ch[fail[u]][i],q.push(ch[u][i]);
			else ch[u][i]=ch[fail[u]][i];
		}
	}
}

int f[M][2],dp[M][N*N/2][2],d;

inline int calc(char *s) {
	int ans=0;
	f[d+1][0]=f[d+1][1]=1;
	for(R int i=d ; i ; --i) f[i][0]=f[i+1][0]*10,f[i][1]=f[i+1][1]+f[i+1][0]*(s[i]-'0');
	for(R int i=1 ; i<=d ; ++i)
		for(R int j=0 ; j<=tot ; ++j)
			for(R int k=0 ; k<2 ; ++k)
				dp[i][j][k]=0;
	dp[0][0][1]=1;
	for(R int i=0 ; i<d ; ++i)
		for(R int j=0 ; j<=tot ; ++j)
			if(!ed[j]) {
				for(R int k=0 ; k<10 ; ++k) {
					int c=ch[j][k];
					(dp[i+1][c][0]+=dp[i][j][0])%=P;
					if(k<s[i+1]-'0') (dp[i+1][c][0]+=dp[i][j][1])%=P;
					if(k==s[i+1]-'0') (dp[i+1][c][1]+=dp[i][j][1])%=P;
				}
			}
	for(R int i=1 ; i<=d ; ++i)
		for(R int j=0 ; j<=tot ; ++j)
			if(ed[j]) (ans+=dp[i][j][0]*f[i+1][0]%P+dp[i][j][1]*f[i+1][1]%P)%=P;
	return ans;
}

signed main() {
	scanf("%s",s+1);
	n=strlen(s+1);
	scanf("%s",a+1),scanf("%s",b+1);
	d=strlen(a+1);
	for(R int i=1 ; i+d/2-1<=n ; ++i) insert(i,i+d/2);
	bfs();
	int w=d;
	while(a[w]=='0') a[w--]='9';
	--a[w];
	printf("%lld",(calc(b)-calc(a)+P)%P);
	return 0;
}


#include<bits/stdc++.h>
#define R register
using namespace std;

inline int read() {
	int res=0,f=1;char ch;
	while(!isdigit(ch=getchar())) if(ch=='-') f=-1;
	do {
		res=res*10+ch-'0';
	} while(isdigit(ch=getchar()));
	return res*f;
}

const int N=1e3+5,M=55,P=1e9+7;

int ch[N*N/4][10],fail[N*N/4],tot,n;
bool ed[N*N/4];

char s[N],a[M],b[M];

inline void insert(int l,int r) {
	int u=0;
	for(R int i=l ; i<r ; ++i) {
		int c=s[i]-'0';
		if(!ch[u][c]) ch[u][c]=++tot;
		u=ch[u][c];
	}
	ed[u]=1;
}

inline void bfs() {
	queue <int> q;
	for(R int i=0 ; i<10 ; ++i) if(ch[0][i]) q.push(ch[0][i]);
	while(!q.empty()) {
		int u=q.front();q.pop();
		for(R int i=0 ; i<10 ; ++i) {
			if(ch[u][i]) fail[ch[u][i]]=ch[fail[u]][i],q.push(ch[u][i]);
			else ch[u][i]=ch[fail[u]][i];
		}
	}
}

int f[M][2],dp[M][N*N/4][2],d;

inline int calc(char *s) {
	int ans=0;
	f[d+1][0]=f[d+1][1]=1;
	for(R int i=d ; i ; --i) f[i][0]=f[i+1][0]*10,f[i][1]=f[i+1][1]+f[i+1][0]*(s[i]-'0');
	for(R int i=1 ; i<=d ; ++i)
		for(R int j=0 ; j<=tot ; ++j)
			for(R int k=0 ; k<2 ; ++k)
				dp[i][j][k]=0;
	dp[0][0][1]=1;
	for(R int i=0 ; i<d ; ++i)
		for(R int j=0 ; j<=tot ; ++j)
			if(!ed[j]) {
				for(R int k=0 ; k<10 ; ++k) {
					int c=ch[j][k];
					(dp[i+1][c][0]+=dp[i][j][0])%=P;
					if(k<s[i+1]-'0') (dp[i+1][c][0]+=dp[i][j][1])%=P;
					if(k==s[i+1]-'0') (dp[i+1][c][1]+=dp[i][j][1])%=P;
				}
			}
	for(R int i=1 ; i<=d ; ++i)
		for(R int j=0 ; j<=tot ; ++j)
			if(ed[j]) ans=(ans+(1LL*dp[i][j][0]*f[i+1][0]+1LL*dp[i][j][1]*f[i+1][1])%P)%P;
	return ans;
}

int main() {
	scanf("%s",s+1);
	n=strlen(s+1);
	scanf("%s",a+1),scanf("%s",b+1);
	d=strlen(a+1);
	for(R int i=1 ; i+d/2-1<=n ; ++i) insert(i,i+d/2);
	bfs();
	int w=d;
	while(a[w]=='0') a[w--]='9';
	--a[w];
	printf("%d\n",(calc(b)-calc(a)+P)%P);
	return 0;
}


#include<bits/stdc++.h>
#define R register
#define int long long
using namespace std;

inline int read() {
	int res=0,f=1;char ch;
	while(!isdigit(ch=getchar())) if(ch=='-') f=-1;
	do {
		res=res*10+ch-'0';
	} while(isdigit(ch=getchar()));
	return res*f;
}

const int N=1e3+5,M=55,P=1e9+7;

int ch[N*N/4][10],fail[N*N/4],tot,n;
bool ed[N*N/4];

char s[N],a[M],b[M];

inline void insert(int l,int r) {
	int u=0;
	for(R int i=l ; i<r ; ++i) {
		int c=s[i]-'0';
		if(!ch[u][c]) ch[u][c]=++tot;
		u=ch[u][c];
	}
	ed[u]=1;
}

inline void bfs() {
	queue <int> q;
	for(R int i=0 ; i<10 ; ++i) if(ch[0][i]) q.push(ch[0][i]);
	while(!q.empty()) {
		int u=q.front();q.pop();
		for(R int i=0 ; i<10 ; ++i) {
			if(ch[u][i]) fail[ch[u][i]]=ch[fail[u]][i],q.push(ch[u][i]);
			else ch[u][i]=ch[fail[u]][i];
		}
	}
}

int f[M][2],dp[M][N*N/4][2],d;

inline int calc(char *s) {
	int ans=0;
	f[d+1][0]=f[d+1][1]=1;
	for(R int i=d ; i ; --i) f[i][0]=f[i+1][0]*10,f[i][1]=f[i+1][1]+f[i+1][0]*(s[i]-'0');
	for(R int i=1 ; i<=d ; ++i)
		for(R int j=0 ; j<=tot ; ++j)
			for(R int k=0 ; k<2 ; ++k)
				dp[i][j][k]=0;
	dp[0][0][1]=1;
	for(R int i=0 ; i<d ; ++i)
		for(R int j=0 ; j<=tot ; ++j)
			if(!ed[j]) {
				for(R int k=0 ; k<10 ; ++k) {
					int c=ch[j][k];
					(dp[i+1][c][0]+=dp[i][j][0])%=P;
					if(k<s[i+1]-'0') (dp[i+1][c][0]+=dp[i][j][1])%=P;
					if(k==s[i+1]-'0') (dp[i+1][c][1]+=dp[i][j][1])%=P;
				}
			}
	for(R int i=1 ; i<=d ; ++i)
		for(R int j=0 ; j<=tot ; ++j)
			if(ed[j]) (ans+=dp[i][j][0]*f[i+1][0]%P+dp[i][j][1]*f[i+1][1]%P)%=P;
	return ans;
}

signed main() {
	scanf("%s",s+1);
	n=strlen(s+1);
	scanf("%s",a+1),scanf("%s",b+1);
	d=strlen(a+1);
	for(R int i=1 ; i+d/2-1<=n ; ++i) insert(i,i+d/2);
	bfs();
	int w=d;
	while(a[w]=='0') a[w--]='9';
	--a[w];
	printf("%lld",(calc(b)-calc(a)+P)%P);
	return 0;
}


#include<bits/stdc++.h>
#define R register
using namespace std;

inline int read() {
	int res=0,f=1;char ch;
	while(!isdigit(ch=getchar())) if(ch=='-') f=-1;
	do {
		res=res*10+ch-'0';
	} while(isdigit(ch=getchar()));
	return res*f;
}

const int N=1e3+5,M=55,P=1e9+7;

int ch[N*N][10],fail[N*N],tot,n;
bool ed[N*N];

char s[N],a[M],b[M];

inline void insert(int l,int r) {
	int u=0;
	for(R int i=l ; i<r ; ++i) {
		int c=s[i]-'0';
		if(!ch[u][c]) ch[u][c]=++tot;
		u=ch[u][c];
	}
	ed[u]=1;
}

inline void bfs() {
	queue <int> q;
	for(R int i=0 ; i<10 ; ++i) if(ch[0][i]) q.push(ch[0][i]);
	while(!q.empty()) {
		int u=q.front();q.pop();
		for(R int i=0 ; i<10 ; ++i) {
			if(ch[u][i]) fail[ch[u][i]]=ch[fail[u]][i],q.push(ch[u][i]);
			else ch[u][i]=ch[fail[u]][i];
		}
	}
}

int f[M][2],dp[M][N*N][2],d;

inline int calc(char *s) {
	int ans=0;
	f[d+1][0]=f[d+1][1]=1;
	for(R int i=d ; i ; --i) f[i][0]=f[i+1][0]*10,f[i][1]=f[i+1][1]+f[i+1][0]*(s[i]-'0');
	for(R int i=1 ; i<=d ; ++i)
		for(R int j=0 ; j<=tot ; ++j)
			for(R int k=0 ; k<2 ; ++k)
				dp[i][j][k]=0;
	dp[0][0][1]=1;
	for(R int i=0 ; i<d ; ++i)
		for(R int j=0 ; j<=tot ; ++j)
			if(!ed[j]) {
				for(R int k=0 ; k<10 ; ++k) {
					int c=ch[j][k];
					(dp[i+1][c][0]+=dp[i][j][0])%=P;
					if(k<s[i+1]-'0') (dp[i+1][c][0]+=dp[i][j][1])%=P;
					if(k==s[i+1]-'0') (dp[i+1][c][1]+=dp[i][j][1])%=P;
				}
			}
	for(R int i=1 ; i<=d ; ++i)
		for(R int j=0 ; j<=tot ; ++j)
			if(ed[j]) ans=(ans+(1LL*dp[i][j][0]*f[i+1][0]+1LL*dp[i][j][1]*f[i+1][1])%P)%P;
	return ans;
}

int main() {
	scanf("%s",s+1);
	n=strlen(s+1);
	scanf("%s",a+1),scanf("%s",b+1);
	d=strlen(a+1);
	for(R int i=1 ; i+d/2-1<=n ; ++i) insert(i,i+d/2);
	bfs();
	int w=d;
	while(a[w]=='0') a[w--]='9';
	--a[w];
	printf("%d\n",(calc(b)-calc(a)+P)%P);
	return 0;
}


#include <queue>
#include <cstdio>
#include <cstring>
using namespace std;
const int Maxn=1000;
const int Maxd=50;
const int Mod=1000000007;
struct Node{
	int ch[10];
	int dep,fail;
}node[Maxn*Maxd+5];
int id_tot;
char s[Maxn+5],x[Maxn+5],y[Maxn+5];
int n,d;
void add(char *s,int len){
	int root=0;
	for(int i=1;i<=len;i++){
		if(node[root].ch[s[i]]==0){
			node[root].ch[s[i]]=++id_tot;
			node[id_tot].dep=node[root].dep+1;
		}
		root=node[root].ch[s[i]];
	}
}
void init_bfs(){
	queue<int> q;
	for(int i=0;i<10;i++){
		if(node[0].ch[i]){
			q.push(node[0].ch[i]);
			node[node[0].ch[i]].fail=0;
		}
	}
	while(!q.empty()){
		int u=q.front();
		q.pop();
		for(int i=0;i<10;i++){
			if(node[u].ch[i]==0){
				node[u].ch[i]=node[node[u].fail].ch[i];
			}
			else{
				node[node[u].ch[i]].fail=node[node[u].fail].ch[i];
				q.push(node[u].ch[i]);
			}
		}
	}
}
int f[Maxd+5][Maxn*Maxd+5][2][2];
int calc(char *s,int len){
	memset(f,0,sizeof f);
	f[0][0][1][0]=1;
	for(int i=0;i<len;i++){
		for(int j=0;j<=id_tot;j++){
			for(int a=0;a<=1;a++){
				for(int b=0;b<=1;b++){
					if(f[i][j][a][b]==0){
						continue;
					}
					for(int k=0;k<10;k++){
						if(a==1&&k>s[i+1]){
							break;
						}
						int &tmp=f[i+1][node[j].ch[k]][a&(k==s[i+1])][b|(node[node[j].ch[k]].dep==(len>>1))];
						tmp=(tmp+f[i][j][a][b])%Mod;
					}
				}
			}
		}
	}
	int ans=0;
	for(int i=0;i<=id_tot;i++){
		ans=(ans+f[len][i][1][1])%Mod;
		ans=(ans+f[len][i][0][1])%Mod;
	}
	return ans;
}
int main(){
	scanf("%s",s+1);
	while(s[++n]!='\0');
	n--;
	scanf("%s",x+1);
	while(x[++d]!='\0');
	d--;
	scanf("%s",y+1);
	for(int i=1;i<=n;i++){
		s[i]-='0';
	}
	for(int i=1;i<=d;i++){
		x[i]-='0';
		y[i]-='0';
	}
	for(int i=1;i<=(n-(d>>1)+1);i++){
		add(s+i-1,d>>1);
	}
	init_bfs();
	x[d]--;
	int tmp=d;
	while(x[tmp]<0){
		x[tmp-1]--;
		x[tmp]=9;
		tmp--;
	}
	printf("%d\n",(calc(y,d)-calc(x,d)+Mod)%Mod);
	return 0;
}


#include <queue>
#include <cstdio>
#include <cstring>
using namespace std;
const int Maxn=1000;
const int Maxd=50;
const int Mod=1000000007;
struct Node{
	int ch[10];
	int dep,fail;
}node[Maxn*Maxd+5];
int id_tot;
char s[Maxn+5],x[Maxn+5],y[Maxn+5];
int n,d;
void add(char *s,int len){
	int root=0;
	for(int i=1;i<=len;i++){
		if(node[root].ch[s[i]]==0){
			node[root].ch[s[i]]=++id_tot;
			node[id_tot].dep=node[root].dep+1;
		}
		root=node[root].ch[s[i]];
	}
}
void init_bfs(){
	queue<int> q;
	for(int i=0;i<10;i++){
		if(node[0].ch[i]){
			q.push(node[0].ch[i]);
			node[node[0].ch[i]].fail=0;
		}
	}
	while(!q.empty()){
		int u=q.front();
		q.pop();
		for(int i=0;i<10;i++){
			if(node[u].ch[i]==0){
				node[u].ch[i]=node[node[u].fail].ch[i];
			}
			else{
				node[node[u].ch[i]].fail=node[node[u].fail].ch[i];
				q.push(node[u].ch[i]);
			}
		}
	}
}
int f[Maxd+5][Maxn*Maxd+5][2][2];
int calc(char *s,int len){
	memset(f,0,sizeof f);
	f[0][0][1][0]=1;
	for(int i=0;i<len;i++){
		for(int j=0;j<=id_tot;j++){
			for(int a=0;a<=1;a++){
				for(int b=0;b<=1;b++){
					if(f[i][j][a][b]==0){
						continue;
					}
					for(int k=0;k<10;k++){
						if(a==1&&k>s[i+1]){
							break;
						}
						int &tmp=f[i+1][node[j].ch[k]][a&(k==s[i+1])][b|(node[node[j].ch[k]].dep==(len>>1))];
						tmp=(tmp+f[i][j][a][b])%Mod;
					}
				}
			}
		}
	}
	int ans=0;
	for(int i=0;i<=id_tot;i++){
		ans=(ans+f[len][i][1][1])%Mod;
		ans=(ans+f[len][i][0][1])%Mod;
	}
	return ans;
}
int main(){
	scanf("%s",s+1);
	while(s[++n]!='\0');
	n--;
	scanf("%s",x+1);
	while(x[++d]!='\0');
	d--;
	scanf("%s",y+1);
	for(int i=1;i<=n;i++){
		s[i]-='0';
	}
	for(int i=1;i<=d;i++){
		x[i]-='0';
		y[i]-='0';
	}
	for(int i=1;i<=(n-(d>>1)+1);i++){
		add(s+i-1,d>>1);
	}
	init_bfs();
	x[d]--;
	int tmp=d;
	while(x[tmp]<0){
		x[tmp-1]--;
		x[tmp]=9;
		tmp--;
	}
	printf("%d\n",calc(y,d)-calc(x,d));
	return 0;
}