#define _CRT_DISABLE_PERFCRIT_LOCKS
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

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

/*MACROS*/
//FUNCTIONS
#define in_range(i, l, r) for(ll i = l; i < r; i++)

#define all(v) begin(v), end(v)
#define rall(v) (v).rbegin(), (v).rend()

#define tr(it, container) for(auto it = begin(container); it != end(container); it++)
#define rtr(it, container) for(auto it = (container).rbegin(); it != (container).rend(); it++)

#define present(element, container) ((container).find(element) != end(container))

#define _T(...) __VA_ARGS__
#define forever() for(;;)

//ABBREVIATIONS
#define sz(c) (ll(c.size()))
#define pb push_back
#define fst first
#define scd second
#define cmpBy(T, field) [](const T& x, const T& y){ return x.field < y.field; }

//TYPE SAFETY
#define sqrt(x) sqrt(1.0*(x))
#define pow(x, n) pow(1.0*(x), n)

//CONSTANTS
#define INF (numeric_limits<int>::max())
#define MINF (numeric_limits<int>::min())
#define LINF (numeric_limits<long long>::max())
#define LMINF (numeric_limits<long long>::min())
#define EPS (1E-9)
#define PI ((long double)3.14159265358979311600)

#define reunique(container) ((container).resize(unique(all(container))-begin(container)))

/*TYPES*/
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;

/*TEMPLATE FUNCTIONS*/
//BIT OPERATIONS
template<typename T> inline int checkbit(T n, T i){return ((n >> i) & T(1));}
inline int bits_count(int v){ v = v - ((v >> 1) & 0x55555555); v = (v & 0x33333333) + ((v >> 2) & 0x33333333); return((v + (v >> 4) & 0xF0F0F0F) * 0x1010101) >> 24; }
inline int bits_count(ll v){ int t = v >> 32; int p = (v & ((1LL << 32) - 1)); return bits_count(t) + bits_count(p); }
unsigned int reverse_bits(register unsigned int x){ x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1)); x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2)); x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4)); x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8)); return((x >> 16) | (x << 16)); }
template<typename T> inline bool isPowerOfTwo(T n){return (n != 0 and ((n&(n-1)) == 0)); }
inline int binlog(int n){ assert(n > 0); return 32-__builtin_clz(n)-1; }
inline int binlog(ll n) { assert(n > 0); return 64-__builtin_clzll(n)-1;  }

void bitprint(int n, int w=32){ for (int i = w-1; i >= 0; i--) { cout << checkbit(n, i); } cout << "\n"; }
void bitprint(ll n, int w=64){ for (ll i = w-1; i >= 0; i--) { cout << checkbit(n, i); } cout << "\n"; }

/*TEMPLATE ALGORITHMS*/
template<typename T> inline T sqr(T x){T x_ = (x); return x_*x_;}
template<typename T> inline T qbr(T x){T x_ = (x); return ((x_*x_)*x_);}
template<typename T> inline int sign(T x){T x_ = (x); return ((x_>T(0))-(x_<T(0)));}
template<typename T> inline T mod(T x, T m){T x_ = (x); return (((x_) >= 0) ? ((x_) % (m)) : ((((x_) % (m))+(m))%(m)));}
template<typename T> inline T gcd(T a, T b){while(b){T t = a % b; a = b; b = t;} return a;}
template<typename T> inline T gcd_ex(T a, T b, T& x, T& y){if(b==0){x=1,y=0; return a;}T x1, y1;T d=gcd_ex(b,a%b,x1,y1);x = y1;y = x1-(a/b)*y1;return d;}
template<typename T> inline T lcm(T a, T b){return (a*(b/gcd(a, b)));}
template<typename A, typename B, typename C>
function<C(A)> combine(function<B(A)> f, function<C(B)> g) {
    return bind(g, bind(f, placeholders::_1));
}

/*COMBINATORS*/
template <typename Collection, typename UnaryOperation> void foreach(Collection &col, UnaryOperation op){for_each(all(col), op);}
template <typename Collection, typename UnaryOperation> Collection fmap(Collection &col, UnaryOperation op){transform(all(col), col.begin(), op); return col;}
template <typename Collection, typename binop> Collection zip(Collection& fc, Collection& sc,binop op) {transform(all(fc), sc.begin(), fc.begin(), op); return fc;}
template <typename Collection, typename Condition> bool exists(Collection& col,Condition con) {auto exist = find_if(all(col), con); return exist != col.end();}
template <typename Collection, typename Predicate> Collection filterNot(Collection& col, Predicate predicate) {auto returnIterator = remove_if(all(col), predicate); col.erase(returnIterator, end(col)); return col;}

//STL INPUT
void fastIO(){ ios::sync_with_stdio(false); cin.tie(nullptr); }
template<class T1, class T2> istream& operator >>(istream& in, pair<T1, T2>& P){in >> P.fst >> P.scd; return in;}
template<class T> istream& operator >>(istream& in, vector<T>& Col){for(auto &el : Col) in >> el; return in;}
template<class T> inline void getarr(T* arr, int l, int r) { in_range(i, l, r) cin >> arr[i]; }

//STL OUTPUT
template<class T1, class T2> ostream& operator <<(ostream& os, const pair<T1, T2>& p){os << "(" << p.fst << ", " << p.scd << ")"; return os;}
template<class T> ostream& operator <<(ostream& os, const vector<vector<T>>& v){for(auto &row : v){ for(auto &el : row) os << el << " "; os << "\n";} return os;}
template<class T> ostream& operator <<(ostream& os, const vector<T>& Col){for(auto &el : Col) os << el << " "; return os;}
template<class T> ostream& operator <<(ostream& os, const set<T>& Col){for(auto &el : Col) os << el << " "; return os;}
template<class T1, class T2> ostream& operator <<(ostream& os, const map<T1, T2>& Col){for(auto &el : Col) os << el << " "; return os;}
template<class T> inline void printarr(T* arr, int l, int r) { in_range(i, l, r) {cout << arr[i] << " ";}; cout << "\n"; }

//VARIADIC INPUT
template<typename First> void read(First& t){ cin >> t; }
template<typename First, typename... Args> void read(First& f, Args&... args){ cin >> f; read(forward<Args&>(args)...); }

//VARIADIC OUTPUT
template<typename T> void print(T&& t){ cout << t << "\n"; }
template<typename First, typename... Args> void print(First&& f, Args&&... args){ cout << f << " "; print(forward<Args&&>(args)...); }
template<typename T> void printLn(T&& t){ cout << t << "\n"; }
template<typename First, typename... Args> void printLn(First&& f, Args&&... args){ cout << f << "\n"; printLn(forward<Args&&>(args)...); }

//VARIADIC TYPE DECLARATION
template <typename T, size_t N> struct MakeTensor{ template <typename... Args> static auto tensor(size_t first, Args... sizes) -> vector<decltype(MakeTensor<T, N-1>::tensor(sizes...))> { auto inner = MakeTensor<T, N-1>::tensor(sizes...); return vector<decltype(inner)>(first, inner);} };
template <typename T> struct MakeTensor<T, 1> { static vector<T> tensor(size_t size) { return vector<T>(size); }};
template <typename T, typename... Args> auto tensor(Args... args) -> decltype(MakeTensor<T, sizeof...(Args)>::tensor(args...)){ return MakeTensor<T, sizeof...(Args)>::tensor(args...); }

//__int128 -- use if supported
//typedef __int128 bigInt;
//istream& operator >>(istream& in, bigInt& n){
//    in >> ws; n = 0;
//    for(char ch = getchar(); isdigit(ch); ch = getchar()){
//        n = n*bigInt(10) + bigInt(ch-'0');
//    }
//    return in;
//}
//ostream& operator <<(ostream& out, bigInt n){
//    int digits[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
//    int representation[36];
//    int pos = 0;
//    while(n){
//        representation[pos++] = digits[n % 10];
//        n /= 10;
//    }
//    for(int i = pos-1; i >= 0; i--){
//        out << representation[i];
//    }
//    return out;
//}

//DEBUG
#define VA_NUM_ARGS(...) VA_NUM_ARGS_IMPL_((0,__VA_ARGS__, 5,4,3,2,1))
#define VA_NUM_ARGS_IMPL_(tuple) VA_NUM_ARGS_IMPL tuple
#define VA_NUM_ARGS_IMPL(_0,_1,_2,_3,_4,_5,N,...) N
#define macro_dispatcher(macro, ...) macro_dispatcher_(macro, VA_NUM_ARGS(__VA_ARGS__))
#define macro_dispatcher_(macro, nargs) macro_dispatcher__(macro, nargs)
#define macro_dispatcher__(macro, nargs) macro_dispatcher___(macro, nargs)
#define macro_dispatcher___(macro, nargs) macro ## nargs
#define DBN1(a)         cerr<<#a<<" = "<<(a)<<"\n"
#define DBN2(a,b)       cerr<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<"\n"
#define DBN3(a,b,c)     cerr<<#a<<" = "<<(a)<<", "<<#b<<" = " <<(b)<<", "<<#c<<" = "<<(c)<<"\n"
#define DBN4(a,b,c,d)   cerr<<#a<<" = "<<(a)<<", "<<#b<<" ="<<(b)<<", "<<#c<<" = "<<(c)<<", "<<#d<<"="<<(d)<<"\n"
#define DBN5(a,b,c,d,e) cerr<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<", "<<#d<<"="<<(d)<<", "<<#e<<"="<<(e)<<"\n"
#define DBN(...) macro_dispatcher(DBN, __VA_ARGS__)(__VA_ARGS__)

#define DEBUG

//EXTREMELY FAST I/O
//const int BUFFSIZE = 2048;
//static char inbuff[BUFFSIZE + 16];
//static char *inp = inbuff;
//static char *linp = inbuff + BUFFSIZE;

// int read_int(){
//  while (*inp && (*inp < '0' || *inp > '9') && *inp != '-') ++inp;
//  bool minus = false;
//  if (*inp == '-') minus = true, ++inp;
//  if (*inp == 0) {
//      memset(inbuff, 0, BUFFSIZE);
//      cin.read(inbuff, BUFFSIZE);
//      inp = inbuff;
//  }
//  int res = *inp++ - '0';
//  if (inp == linp) {
//      memset(inbuff, 0, BUFFSIZE);
//      cin.read(inbuff, BUFFSIZE);
//      inp = inbuff;
//  }
//  while (*inp >= '0' && *inp <= '9') {
//      res = res*10 + *inp - '0';
//      ++inp;
//      if (inp == linp) {
//          memset(inbuff, 0, BUFFSIZE);
//          cin.read(inbuff, BUFFSIZE);
//          inp = inbuff;
//      }
//  }
//  return minus ? -res : res;
// }

//static char outbuff[BUFFSIZE + 16];
//static char *outp = outbuff;
//static char *loutp = outbuff+BUFFSIZE;
//
//void write_int(int x, bool last = false) {
//  char *begp = outp;
//  if (x == 0) {
//        *outp++ = '0';
//  }
//  while(x) {
//      int quot = x/10;
//      char c = x - 10*quot + '0';
//      *outp++ = c;
//      x = quot;
//  }
//  char *endp = outp-1;
//  while(begp < endp) {
//      swap(*begp, *endp);
//      ++begp, --endp;
//  }
////    *outp++ = '\n';
//  if (last || outp > loutp) {
//      cout.write(outbuff, outp - outbuff);
//      outp/= outbuff;
//  }
//}

template<int N, char Aa = '0', char Az = '9'>
struct AhoCorasick{
const static int A = Az-Aa+1;
    int trie[N][A];
    int size = 0;
    int end[N], link[N], endLink[N];

    int add_node() {
        memset(trie[size], 0, A * sizeof(int));
        end[size] = link[size] = endLink[size] = 0;
        return size++;
    }

    AhoCorasick() { init(); }
    void init() { size = 0; add_node(); }
    void add_string(const char* s, int n) {
        int state = 0;
        for (int i = 0; i < n; i++) {
            int c = s[i]-Aa;
            if (!trie[state][c]) trie[state][c] = add_node();
            state = trie[state][c];
        }
        end[state] = n;
    }
    void construct(bool addEdges = true) {
        int queue[N];
        queue[0] = 0;
        for (int *head = queue, *tail = head+1; head != tail; head++) {
            for (int c = 0; c < A; c++) {
                if (trie[*head][c]) {
                    int from = link[*head];
                    while (from != 0 && !trie[from][c]) from = link[from];
                    link[trie[*head][c]] = *head == 0 ? 0 : trie[from][c];
                    *tail++ = trie[*head][c];
                } else {
                    if (addEdges) trie[*head][c] = trie[link[*head]][c];
                }
                endLink[*head] = end[link[*head]] ? link[*head] : endLink[link[*head]];
            }
        }
    }
    int search(const char* text, int n) {
        int answ = numeric_limits<int>::max();
        for (int state = 0, i = 0; i < n; i++) {
            int c = text[i]-Aa;
            while (state != 0 && !trie[state][c]) state = link[state];
            state = trie[state][c];
            for (int from = state; from != 0; from = endLink[from]) if (end[from]) {
                answ = min(answ, int(i+1-end[from]));
//                printf("occurence found at [%d, %d): ", i+1-end[from], i+1);
//                for (int j = i+1-end[from]; j < i+1; j++) {
//                    printf("%c", text[j]);
//                } puts("");
            }
        }
        return answ;
    }
};
const int MAXN = 1001, MAXLEN = 51, MAXV = MAXN*MAXLEN/2;
const int MOD = 1e9+7;
char s[MAXN], x[MAXLEN], y[MAXLEN];
AhoCorasick<MAXN> AC;
int dp[MAXLEN][MAXV][8];

int main(){
//    fastIO();
//    freopen("in", "r", stdin);
//    freopen("out", "w", stdout);
    scanf("%s%s%s", s, x, y);
    int n = strlen(s);
    int d = strlen(x);
    int halfd = d/2;
    for (int i = 0; i < n-halfd+1; i++) {
        AC.add_string(s+i, halfd);
    }
    AC.construct();
    dp[0][0][3] = 1;
    for (int len = 0; len < d; len++) {
        for (int v = 0; v < AC.size; v++) {
            for (int mask = 0; mask < 8; mask++) {
                if (dp[len][v][mask]) {
                    for (int c = 0; c < 10; c++) {
                        int newmask = mask&4;
                        if (mask & 1) {
                            if (x[len]-'0' > c) continue;
                            if (x[len]-'0' == c) newmask |= 1;
                        }
                        if (mask & 2) {
                            if (y[len]-'0' < c) continue;
                            if (y[len]-'0' == c) newmask |= 2;
                        }
                        int u = AC.trie[v][c];
                        if (AC.end[u]) newmask |= 4;
                        int &res = dp[len+1][u][newmask];
                        res += dp[len][v][mask];
                        res %= MOD;
                        if (res < 0)
                            res += MOD;
                    }
                }
            }
        }
    }
    int answ = 0;
    for (int v = 0; v < AC.size; v++) {
        for (int mask = 0; mask < 4; mask++) {
            answ += dp[d][v][mask|4];
            answ %= MOD;
            if (answ < 0) answ += MOD;
        }
    }
    printf("%d\n", answ);
    return 0;
}


#define _CRT_DISABLE_PERFCRIT_LOCKS
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

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

/*MACROS*/
//FUNCTIONS
#define in_range(i, l, r) for(ll i = l; i < r; i++)

#define all(v) begin(v), end(v)
#define rall(v) (v).rbegin(), (v).rend()

#define tr(it, container) for(auto it = begin(container); it != end(container); it++)
#define rtr(it, container) for(auto it = (container).rbegin(); it != (container).rend(); it++)

#define present(element, container) ((container).find(element) != end(container))

#define _T(...) __VA_ARGS__
#define forever() for(;;)

//ABBREVIATIONS
#define sz(c) (ll(c.size()))
#define pb push_back
#define fst first
#define scd second
#define cmpBy(T, field) [](const T& x, const T& y){ return x.field < y.field; }

//TYPE SAFETY
#define sqrt(x) sqrt(1.0*(x))
#define pow(x, n) pow(1.0*(x), n)

//CONSTANTS
#define INF (numeric_limits<int>::max())
#define MINF (numeric_limits<int>::min())
#define LINF (numeric_limits<long long>::max())
#define LMINF (numeric_limits<long long>::min())
#define EPS (1E-9)
#define PI ((long double)3.14159265358979311600)

#define reunique(container) ((container).resize(unique(all(container))-begin(container)))

/*TYPES*/
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;

/*TEMPLATE FUNCTIONS*/
//BIT OPERATIONS
template<typename T> inline int checkbit(T n, T i){return ((n >> i) & T(1));}
inline int bits_count(int v){ v = v - ((v >> 1) & 0x55555555); v = (v & 0x33333333) + ((v >> 2) & 0x33333333); return((v + (v >> 4) & 0xF0F0F0F) * 0x1010101) >> 24; }
inline int bits_count(ll v){ int t = v >> 32; int p = (v & ((1LL << 32) - 1)); return bits_count(t) + bits_count(p); }
unsigned int reverse_bits(register unsigned int x){ x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1)); x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2)); x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4)); x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8)); return((x >> 16) | (x << 16)); }
template<typename T> inline bool isPowerOfTwo(T n){return (n != 0 and ((n&(n-1)) == 0)); }
inline int binlog(int n){ assert(n > 0); return 32-__builtin_clz(n)-1; }
inline int binlog(ll n) { assert(n > 0); return 64-__builtin_clzll(n)-1;  }

void bitprint(int n, int w=32){ for (int i = w-1; i >= 0; i--) { cout << checkbit(n, i); } cout << "\n"; }
void bitprint(ll n, int w=64){ for (ll i = w-1; i >= 0; i--) { cout << checkbit(n, i); } cout << "\n"; }

/*TEMPLATE ALGORITHMS*/
template<typename T> inline T sqr(T x){T x_ = (x); return x_*x_;}
template<typename T> inline T qbr(T x){T x_ = (x); return ((x_*x_)*x_);}
template<typename T> inline int sign(T x){T x_ = (x); return ((x_>T(0))-(x_<T(0)));}
template<typename T> inline T mod(T x, T m){T x_ = (x); return (((x_) >= 0) ? ((x_) % (m)) : ((((x_) % (m))+(m))%(m)));}
template<typename T> inline T gcd(T a, T b){while(b){T t = a % b; a = b; b = t;} return a;}
template<typename T> inline T gcd_ex(T a, T b, T& x, T& y){if(b==0){x=1,y=0; return a;}T x1, y1;T d=gcd_ex(b,a%b,x1,y1);x = y1;y = x1-(a/b)*y1;return d;}
template<typename T> inline T lcm(T a, T b){return (a*(b/gcd(a, b)));}
template<typename A, typename B, typename C>
function<C(A)> combine(function<B(A)> f, function<C(B)> g) {
    return bind(g, bind(f, placeholders::_1));
}

/*COMBINATORS*/
template <typename Collection, typename UnaryOperation> void foreach(Collection &col, UnaryOperation op){for_each(all(col), op);}
template <typename Collection, typename UnaryOperation> Collection fmap(Collection &col, UnaryOperation op){transform(all(col), col.begin(), op); return col;}
template <typename Collection, typename binop> Collection zip(Collection& fc, Collection& sc,binop op) {transform(all(fc), sc.begin(), fc.begin(), op); return fc;}
template <typename Collection, typename Condition> bool exists(Collection& col,Condition con) {auto exist = find_if(all(col), con); return exist != col.end();}
template <typename Collection, typename Predicate> Collection filterNot(Collection& col, Predicate predicate) {auto returnIterator = remove_if(all(col), predicate); col.erase(returnIterator, end(col)); return col;}

//STL INPUT
void fastIO(){ ios::sync_with_stdio(false); cin.tie(nullptr); }
template<class T1, class T2> istream& operator >>(istream& in, pair<T1, T2>& P){in >> P.fst >> P.scd; return in;}
template<class T> istream& operator >>(istream& in, vector<T>& Col){for(auto &el : Col) in >> el; return in;}
template<class T> inline void getarr(T* arr, int l, int r) { in_range(i, l, r) cin >> arr[i]; }

//STL OUTPUT
template<class T1, class T2> ostream& operator <<(ostream& os, const pair<T1, T2>& p){os << "(" << p.fst << ", " << p.scd << ")"; return os;}
template<class T> ostream& operator <<(ostream& os, const vector<vector<T>>& v){for(auto &row : v){ for(auto &el : row) os << el << " "; os << "\n";} return os;}
template<class T> ostream& operator <<(ostream& os, const vector<T>& Col){for(auto &el : Col) os << el << " "; return os;}
template<class T> ostream& operator <<(ostream& os, const set<T>& Col){for(auto &el : Col) os << el << " "; return os;}
template<class T1, class T2> ostream& operator <<(ostream& os, const map<T1, T2>& Col){for(auto &el : Col) os << el << " "; return os;}
template<class T> inline void printarr(T* arr, int l, int r) { in_range(i, l, r) {cout << arr[i] << " ";}; cout << "\n"; }

//VARIADIC INPUT
template<typename First> void read(First& t){ cin >> t; }
template<typename First, typename... Args> void read(First& f, Args&... args){ cin >> f; read(forward<Args&>(args)...); }

//VARIADIC OUTPUT
template<typename T> void print(T&& t){ cout << t << "\n"; }
template<typename First, typename... Args> void print(First&& f, Args&&... args){ cout << f << " "; print(forward<Args&&>(args)...); }
template<typename T> void printLn(T&& t){ cout << t << "\n"; }
template<typename First, typename... Args> void printLn(First&& f, Args&&... args){ cout << f << "\n"; printLn(forward<Args&&>(args)...); }

//VARIADIC TYPE DECLARATION
template <typename T, size_t N> struct MakeTensor{ template <typename... Args> static auto tensor(size_t first, Args... sizes) -> vector<decltype(MakeTensor<T, N-1>::tensor(sizes...))> { auto inner = MakeTensor<T, N-1>::tensor(sizes...); return vector<decltype(inner)>(first, inner);} };
template <typename T> struct MakeTensor<T, 1> { static vector<T> tensor(size_t size) { return vector<T>(size); }};
template <typename T, typename... Args> auto tensor(Args... args) -> decltype(MakeTensor<T, sizeof...(Args)>::tensor(args...)){ return MakeTensor<T, sizeof...(Args)>::tensor(args...); }

//__int128 -- use if supported
//typedef __int128 bigInt;
//istream& operator >>(istream& in, bigInt& n){
//    in >> ws; n = 0;
//    for(char ch = getchar(); isdigit(ch); ch = getchar()){
//        n = n*bigInt(10) + bigInt(ch-'0');
//    }
//    return in;
//}
//ostream& operator <<(ostream& out, bigInt n){
//    int digits[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
//    int representation[36];
//    int pos = 0;
//    while(n){
//        representation[pos++] = digits[n % 10];
//        n /= 10;
//    }
//    for(int i = pos-1; i >= 0; i--){
//        out << representation[i];
//    }
//    return out;
//}

//DEBUG
#define VA_NUM_ARGS(...) VA_NUM_ARGS_IMPL_((0,__VA_ARGS__, 5,4,3,2,1))
#define VA_NUM_ARGS_IMPL_(tuple) VA_NUM_ARGS_IMPL tuple
#define VA_NUM_ARGS_IMPL(_0,_1,_2,_3,_4,_5,N,...) N
#define macro_dispatcher(macro, ...) macro_dispatcher_(macro, VA_NUM_ARGS(__VA_ARGS__))
#define macro_dispatcher_(macro, nargs) macro_dispatcher__(macro, nargs)
#define macro_dispatcher__(macro, nargs) macro_dispatcher___(macro, nargs)
#define macro_dispatcher___(macro, nargs) macro ## nargs
#define DBN1(a)         cerr<<#a<<" = "<<(a)<<"\n"
#define DBN2(a,b)       cerr<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<"\n"
#define DBN3(a,b,c)     cerr<<#a<<" = "<<(a)<<", "<<#b<<" = " <<(b)<<", "<<#c<<" = "<<(c)<<"\n"
#define DBN4(a,b,c,d)   cerr<<#a<<" = "<<(a)<<", "<<#b<<" ="<<(b)<<", "<<#c<<" = "<<(c)<<", "<<#d<<"="<<(d)<<"\n"
#define DBN5(a,b,c,d,e) cerr<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<", "<<#d<<"="<<(d)<<", "<<#e<<"="<<(e)<<"\n"
#define DBN(...) macro_dispatcher(DBN, __VA_ARGS__)(__VA_ARGS__)

#define DEBUG

//EXTREMELY FAST I/O
//const int BUFFSIZE = 2048;
//static char inbuff[BUFFSIZE + 16];
//static char *inp = inbuff;
//static char *linp = inbuff + BUFFSIZE;

// int read_int(){
//  while (*inp && (*inp < '0' || *inp > '9') && *inp != '-') ++inp;
//  bool minus = false;
//  if (*inp == '-') minus = true, ++inp;
//  if (*inp == 0) {
//      memset(inbuff, 0, BUFFSIZE);
//      cin.read(inbuff, BUFFSIZE);
//      inp = inbuff;
//  }
//  int res = *inp++ - '0';
//  if (inp == linp) {
//      memset(inbuff, 0, BUFFSIZE);
//      cin.read(inbuff, BUFFSIZE);
//      inp = inbuff;
//  }
//  while (*inp >= '0' && *inp <= '9') {
//      res = res*10 + *inp - '0';
//      ++inp;
//      if (inp == linp) {
//          memset(inbuff, 0, BUFFSIZE);
//          cin.read(inbuff, BUFFSIZE);
//          inp = inbuff;
//      }
//  }
//  return minus ? -res : res;
// }

//static char outbuff[BUFFSIZE + 16];
//static char *outp = outbuff;
//static char *loutp = outbuff+BUFFSIZE;
//
//void write_int(int x, bool last = false) {
//  char *begp = outp;
//  if (x == 0) {
//        *outp++ = '0';
//  }
//  while(x) {
//      int quot = x/10;
//      char c = x - 10*quot + '0';
//      *outp++ = c;
//      x = quot;
//  }
//  char *endp = outp-1;
//  while(begp < endp) {
//      swap(*begp, *endp);
//      ++begp, --endp;
//  }
////    *outp++ = '\n';
//  if (last || outp > loutp) {
//      cout.write(outbuff, outp - outbuff);
//      outp/= outbuff;
//  }
//}

template<int N, char Aa = '0', char Az = '9'>
struct AhoCorasick{
const static int A = Az-Aa+1;
    int trie[N][A];
    int size = 0;
    int end[N], link[N], endLink[N];

    int add_node() {
        memset(trie[size], 0, A * sizeof(int));
        end[size] = link[size] = endLink[size] = 0;
        return size++;
    }

    AhoCorasick() { init(); }
    void init() { size = 0; add_node(); }
    void add_string(const char* s, int n) {
        int state = 0;
        for (int i = 0; i < n; i++) {
            int c = s[i]-Aa;
            if (!trie[state][c]) trie[state][c] = add_node();
            state = trie[state][c];
        }
        end[state] = n;
    }
    void construct(bool addEdges = true) {
        int queue[N];
        queue[0] = 0;
        for (int *head = queue, *tail = head+1; head != tail; head++) {
            for (int c = 0; c < A; c++) {
                if (trie[*head][c]) {
                    int from = link[*head];
                    while (from != 0 && !trie[from][c]) from = link[from];
                    link[trie[*head][c]] = *head == 0 ? 0 : trie[from][c];
                    *tail++ = trie[*head][c];
                } else {
                    if (addEdges) trie[*head][c] = trie[link[*head]][c];
                }
                endLink[*head] = end[link[*head]] ? link[*head] : endLink[link[*head]];
            }
        }
    }
    int search(const char* text, int n) {
        int answ = numeric_limits<int>::max();
        for (int state = 0, i = 0; i < n; i++) {
            int c = text[i]-Aa;
            while (state != 0 && !trie[state][c]) state = link[state];
            state = trie[state][c];
            for (int from = state; from != 0; from = endLink[from]) if (end[from]) {
                answ = min(answ, int(i+1-end[from]));
//                printf("occurence found at [%d, %d): ", i+1-end[from], i+1);
//                for (int j = i+1-end[from]; j < i+1; j++) {
//                    printf("%c", text[j]);
//                } puts("");
            }
        }
        return answ;
    }
};
const int MAXN = 1001, MAXLEN = 51, MAXV = MAXN*MAXLEN/2;
const ll MOD = 1e9+7;
char s[MAXN], x[MAXLEN], y[MAXLEN];
AhoCorasick<MAXN> AC;
ll dp[MAXLEN][MAXV][8];

int main(){
//    fastIO();
//    freopen("in", "r", stdin);
//    freopen("out", "w", stdout);
    scanf("%s%s%s", s, x, y);
    int n = strlen(s);
    int d = strlen(x);
    int halfd = d/2;
    for (int i = 0; i < n-halfd+1; i++) {
        AC.add_string(s+i, halfd);
    }
    AC.construct();
    dp[0][0][3] = 1;
    for (int len = 0; len < d; len++) {
        for (int v = 0; v < AC.size; v++) {
            for (int mask = 0; mask < 8; mask++) {
                if (dp[len][v][mask]) {
                    for (int c = 0; c < 10; c++) {
                        int newmask = mask&4;
                        if (mask & 1) {
                            if (x[len]-'0' > c) continue;
                            if (x[len]-'0' == c) newmask |= 1;
                        }
                        if (mask & 2) {
                            if (y[len]-'0' < c) continue;
                            if (y[len]-'0' == c) newmask |= 2;
                        }
                        int u = AC.trie[v][c];
                        if (AC.end[u]) newmask |= 4;
                        dp[len+1][u][newmask] += dp[len][v][mask];
                        dp[len+1][u][newmask] = mod(dp[len+1][u][newmask], MOD);
                    }
                }
            }
        }
    }
    ll answ = 0;
    for (int v = 0; v < AC.size; v++) {
        for (int mask = 0; mask < 4; mask++) {
            answ += dp[d][v][mask|4];
            answ = mod(answ, MOD);
        }
    }
    print(answ);
    return 0;
}


#define _CRT_DISABLE_PERFCRIT_LOCKS
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

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

/*MACROS*/
//FUNCTIONS
#define in_range(i, l, r) for(ll i = l; i < r; i++)

#define all(v) begin(v), end(v)
#define rall(v) (v).rbegin(), (v).rend()

#define tr(it, container) for(auto it = begin(container); it != end(container); it++)
#define rtr(it, container) for(auto it = (container).rbegin(); it != (container).rend(); it++)

#define present(element, container) ((container).find(element) != end(container))

#define _T(...) __VA_ARGS__
#define forever() for(;;)

//ABBREVIATIONS
#define sz(c) (ll(c.size()))
#define pb push_back
#define fst first
#define scd second
#define cmpBy(T, field) [](const T& x, const T& y){ return x.field < y.field; }

//TYPE SAFETY
#define sqrt(x) sqrt(1.0*(x))
#define pow(x, n) pow(1.0*(x), n)

//CONSTANTS
#define INF (numeric_limits<int>::max())
#define MINF (numeric_limits<int>::min())
#define LINF (numeric_limits<long long>::max())
#define LMINF (numeric_limits<long long>::min())
#define EPS (1E-9)
#define PI ((long double)3.14159265358979311600)

#define reunique(container) ((container).resize(unique(all(container))-begin(container)))

/*TYPES*/
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;

/*TEMPLATE FUNCTIONS*/
//BIT OPERATIONS
template<typename T> inline int checkbit(T n, T i){return ((n >> i) & T(1));}
inline int bits_count(int v){ v = v - ((v >> 1) & 0x55555555); v = (v & 0x33333333) + ((v >> 2) & 0x33333333); return((v + (v >> 4) & 0xF0F0F0F) * 0x1010101) >> 24; }
inline int bits_count(ll v){ int t = v >> 32; int p = (v & ((1LL << 32) - 1)); return bits_count(t) + bits_count(p); }
unsigned int reverse_bits(register unsigned int x){ x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1)); x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2)); x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4)); x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8)); return((x >> 16) | (x << 16)); }
template<typename T> inline bool isPowerOfTwo(T n){return (n != 0 and ((n&(n-1)) == 0)); }
inline int binlog(int n){ assert(n > 0); return 32-__builtin_clz(n)-1; }
inline int binlog(ll n) { assert(n > 0); return 64-__builtin_clzll(n)-1;  }

void bitprint(int n, int w=32){ for (int i = w-1; i >= 0; i--) { cout << checkbit(n, i); } cout << "\n"; }
void bitprint(ll n, int w=64){ for (ll i = w-1; i >= 0; i--) { cout << checkbit(n, i); } cout << "\n"; }

/*TEMPLATE ALGORITHMS*/
template<typename T> inline T sqr(T x){T x_ = (x); return x_*x_;}
template<typename T> inline T qbr(T x){T x_ = (x); return ((x_*x_)*x_);}
template<typename T> inline int sign(T x){T x_ = (x); return ((x_>T(0))-(x_<T(0)));}
template<typename T> inline T mod(T x, T m){T x_ = (x); return (((x_) >= 0) ? ((x_) % (m)) : ((((x_) % (m))+(m))%(m)));}
template<typename T> inline T gcd(T a, T b){while(b){T t = a % b; a = b; b = t;} return a;}
template<typename T> inline T gcd_ex(T a, T b, T& x, T& y){if(b==0){x=1,y=0; return a;}T x1, y1;T d=gcd_ex(b,a%b,x1,y1);x = y1;y = x1-(a/b)*y1;return d;}
template<typename T> inline T lcm(T a, T b){return (a*(b/gcd(a, b)));}
template<typename A, typename B, typename C>
function<C(A)> combine(function<B(A)> f, function<C(B)> g) {
    return bind(g, bind(f, placeholders::_1));
}

/*COMBINATORS*/
template <typename Collection, typename UnaryOperation> void foreach(Collection &col, UnaryOperation op){for_each(all(col), op);}
template <typename Collection, typename UnaryOperation> Collection fmap(Collection &col, UnaryOperation op){transform(all(col), col.begin(), op); return col;}
template <typename Collection, typename binop> Collection zip(Collection& fc, Collection& sc,binop op) {transform(all(fc), sc.begin(), fc.begin(), op); return fc;}
template <typename Collection, typename Condition> bool exists(Collection& col,Condition con) {auto exist = find_if(all(col), con); return exist != col.end();}
template <typename Collection, typename Predicate> Collection filterNot(Collection& col, Predicate predicate) {auto returnIterator = remove_if(all(col), predicate); col.erase(returnIterator, end(col)); return col;}

//STL INPUT
void fastIO(){ ios::sync_with_stdio(false); cin.tie(nullptr); }
template<class T1, class T2> istream& operator >>(istream& in, pair<T1, T2>& P){in >> P.fst >> P.scd; return in;}
template<class T> istream& operator >>(istream& in, vector<T>& Col){for(auto &el : Col) in >> el; return in;}
template<class T> inline void getarr(T* arr, int l, int r) { in_range(i, l, r) cin >> arr[i]; }

//STL OUTPUT
template<class T1, class T2> ostream& operator <<(ostream& os, const pair<T1, T2>& p){os << "(" << p.fst << ", " << p.scd << ")"; return os;}
template<class T> ostream& operator <<(ostream& os, const vector<vector<T>>& v){for(auto &row : v){ for(auto &el : row) os << el << " "; os << "\n";} return os;}
template<class T> ostream& operator <<(ostream& os, const vector<T>& Col){for(auto &el : Col) os << el << " "; return os;}
template<class T> ostream& operator <<(ostream& os, const set<T>& Col){for(auto &el : Col) os << el << " "; return os;}
template<class T1, class T2> ostream& operator <<(ostream& os, const map<T1, T2>& Col){for(auto &el : Col) os << el << " "; return os;}
template<class T> inline void printarr(T* arr, int l, int r) { in_range(i, l, r) {cout << arr[i] << " ";}; cout << "\n"; }

//VARIADIC INPUT
template<typename First> void read(First& t){ cin >> t; }
template<typename First, typename... Args> void read(First& f, Args&... args){ cin >> f; read(forward<Args&>(args)...); }

//VARIADIC OUTPUT
template<typename T> void print(T&& t){ cout << t << "\n"; }
template<typename First, typename... Args> void print(First&& f, Args&&... args){ cout << f << " "; print(forward<Args&&>(args)...); }
template<typename T> void printLn(T&& t){ cout << t << "\n"; }
template<typename First, typename... Args> void printLn(First&& f, Args&&... args){ cout << f << "\n"; printLn(forward<Args&&>(args)...); }

//VARIADIC TYPE DECLARATION
template <typename T, size_t N> struct MakeTensor{ template <typename... Args> static auto tensor(size_t first, Args... sizes) -> vector<decltype(MakeTensor<T, N-1>::tensor(sizes...))> { auto inner = MakeTensor<T, N-1>::tensor(sizes...); return vector<decltype(inner)>(first, inner);} };
template <typename T> struct MakeTensor<T, 1> { static vector<T> tensor(size_t size) { return vector<T>(size); }};
template <typename T, typename... Args> auto tensor(Args... args) -> decltype(MakeTensor<T, sizeof...(Args)>::tensor(args...)){ return MakeTensor<T, sizeof...(Args)>::tensor(args...); }

//__int128 -- use if supported
//typedef __int128 bigInt;
//istream& operator >>(istream& in, bigInt& n){
//    in >> ws; n = 0;
//    for(char ch = getchar(); isdigit(ch); ch = getchar()){
//        n = n*bigInt(10) + bigInt(ch-'0');
//    }
//    return in;
//}
//ostream& operator <<(ostream& out, bigInt n){
//    int digits[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
//    int representation[36];
//    int pos = 0;
//    while(n){
//        representation[pos++] = digits[n % 10];
//        n /= 10;
//    }
//    for(int i = pos-1; i >= 0; i--){
//        out << representation[i];
//    }
//    return out;
//}

//DEBUG
#define VA_NUM_ARGS(...) VA_NUM_ARGS_IMPL_((0,__VA_ARGS__, 5,4,3,2,1))
#define VA_NUM_ARGS_IMPL_(tuple) VA_NUM_ARGS_IMPL tuple
#define VA_NUM_ARGS_IMPL(_0,_1,_2,_3,_4,_5,N,...) N
#define macro_dispatcher(macro, ...) macro_dispatcher_(macro, VA_NUM_ARGS(__VA_ARGS__))
#define macro_dispatcher_(macro, nargs) macro_dispatcher__(macro, nargs)
#define macro_dispatcher__(macro, nargs) macro_dispatcher___(macro, nargs)
#define macro_dispatcher___(macro, nargs) macro ## nargs
#define DBN1(a)         cerr<<#a<<" = "<<(a)<<"\n"
#define DBN2(a,b)       cerr<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<"\n"
#define DBN3(a,b,c)     cerr<<#a<<" = "<<(a)<<", "<<#b<<" = " <<(b)<<", "<<#c<<" = "<<(c)<<"\n"
#define DBN4(a,b,c,d)   cerr<<#a<<" = "<<(a)<<", "<<#b<<" ="<<(b)<<", "<<#c<<" = "<<(c)<<", "<<#d<<"="<<(d)<<"\n"
#define DBN5(a,b,c,d,e) cerr<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<", "<<#d<<"="<<(d)<<", "<<#e<<"="<<(e)<<"\n"
#define DBN(...) macro_dispatcher(DBN, __VA_ARGS__)(__VA_ARGS__)

#define DEBUG

//EXTREMELY FAST I/O
//const int BUFFSIZE = 2048;
//static char inbuff[BUFFSIZE + 16];
//static char *inp = inbuff;
//static char *linp = inbuff + BUFFSIZE;

// int read_int(){
//  while (*inp && (*inp < '0' || *inp > '9') && *inp != '-') ++inp;
//  bool minus = false;
//  if (*inp == '-') minus = true, ++inp;
//  if (*inp == 0) {
//      memset(inbuff, 0, BUFFSIZE);
//      cin.read(inbuff, BUFFSIZE);
//      inp = inbuff;
//  }
//  int res = *inp++ - '0';
//  if (inp == linp) {
//      memset(inbuff, 0, BUFFSIZE);
//      cin.read(inbuff, BUFFSIZE);
//      inp = inbuff;
//  }
//  while (*inp >= '0' && *inp <= '9') {
//      res = res*10 + *inp - '0';
//      ++inp;
//      if (inp == linp) {
//          memset(inbuff, 0, BUFFSIZE);
//          cin.read(inbuff, BUFFSIZE);
//          inp = inbuff;
//      }
//  }
//  return minus ? -res : res;
// }

//static char outbuff[BUFFSIZE + 16];
//static char *outp = outbuff;
//static char *loutp = outbuff+BUFFSIZE;
//
//void write_int(int x, bool last = false) {
//  char *begp = outp;
//  if (x == 0) {
//        *outp++ = '0';
//  }
//  while(x) {
//      int quot = x/10;
//      char c = x - 10*quot + '0';
//      *outp++ = c;
//      x = quot;
//  }
//  char *endp = outp-1;
//  while(begp < endp) {
//      swap(*begp, *endp);
//      ++begp, --endp;
//  }
////    *outp++ = '\n';
//  if (last || outp > loutp) {
//      cout.write(outbuff, outp - outbuff);
//      outp/= outbuff;
//  }
//}

template<int N, char Aa = '0', char Az = '9'>
struct AhoCorasick{
const static int A = Az-Aa+1;
    int trie[N][A];
    int size = 0;
    bool end[N];
    int link[N];
    int queue[N];

    int add_node() {
        memset(trie[size], 0, A * sizeof(int));
        end[size] = link[size] = 0;
        return size++;
    }

    AhoCorasick() { init(); }
    void init() { size = 0; add_node(); }
    void add_string(const char* s, int n) {
        int state = 0;
        for (int i = 0; i < n; i++) {
            int c = s[i]-Aa;
            if (!trie[state][c]) trie[state][c] = add_node();
            state = trie[state][c];
        }
        end[state] = true;
    }
    void construct() {
        queue[0] = 0;
        for (int qa = 0, qb = 1; qa != qb; ++qa) {
            int v = queue[qa];
            for (int c = 0; c < A; c++) {
                if (trie[v][c]) {
                    int u = link[v];
                    while (u != 0 && !trie[u][c]) u = link[u];
                    link[trie[v][c]] = v == 0 ? 0 : trie[u][c];
                    q[qb++] = trie[v][c];
                } else {
                    trie[v][c] = trie[link[v]][c];
                }
            }
        }
    }
};

const int MAXN = 1001, MAXLEN = 51, MAXV = MAXN*MAXLEN/2;
const int MOD = 1e9+7;
char s[MAXN], x[MAXLEN], y[MAXLEN];
AhoCorasick<MAXN> AC;
int dp[MAXLEN][MAXV][8];

int main(){
//    fastIO();
//    freopen("in", "r", stdin);
//    freopen("out", "w", stdout);
    scanf("%s%s%s", s, x, y);
    int n = strlen(s);
    int d = strlen(x);
    int halfd = d/2;
    for (int i = 0; i < n-halfd+1; i++) {
        AC.add_string(s+i, halfd);
    }
    AC.construct();
    dp[0][0][3] = 1;
    for (int len = 0; len < d; len++) {
        for (int v = 0; v < AC.size; v++) {
            for (int mask = 0; mask < 8; mask++) {
                if (dp[len][v][mask]) {
                    for (int c = 0; c < 10; c++) {
                        int newmask = mask&4;
                        if (mask & 1) {
                            if (x[len]-'0' > c) continue;
                            if (x[len]-'0' == c) newmask |= 1;
                        }
                        if (mask & 2) {
                            if (y[len]-'0' < c) continue;
                            if (y[len]-'0' == c) newmask |= 2;
                        }
                        int u = AC.trie[v][c];
                        if (AC.end[u]) newmask |= 4;
                        int &res = dp[len+1][u][newmask];
                        res += dp[len][v][mask];
                        if (res >= MOD) res -= MOD;
                    }
                }
            }
        }
    }
    int answ = 0;
    for (int v = 0; v < AC.size; v++) {
        for (int mask = 0; mask < 4; mask++) {
            answ += dp[d][v][mask|4];
            if (answ >= MOD) answ -= MOD;
        }
    }
    printf("%d\n", answ);
    return 0;
}


#define _CRT_DISABLE_PERFCRIT_LOCKS
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

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

/*MACROS*/
//FUNCTIONS
#define in_range(i, l, r) for(ll i = l; i < r; i++)

#define all(v) begin(v), end(v)
#define rall(v) (v).rbegin(), (v).rend()

#define tr(it, container) for(auto it = begin(container); it != end(container); it++)
#define rtr(it, container) for(auto it = (container).rbegin(); it != (container).rend(); it++)

#define present(element, container) ((container).find(element) != end(container))

#define _T(...) __VA_ARGS__
#define forever() for(;;)

//ABBREVIATIONS
#define sz(c) (ll(c.size()))
#define pb push_back
#define fst first
#define scd second
#define cmpBy(T, field) [](const T& x, const T& y){ return x.field < y.field; }

//TYPE SAFETY
#define sqrt(x) sqrt(1.0*(x))
#define pow(x, n) pow(1.0*(x), n)

//CONSTANTS
#define INF (numeric_limits<int>::max())
#define MINF (numeric_limits<int>::min())
#define LINF (numeric_limits<long long>::max())
#define LMINF (numeric_limits<long long>::min())
#define EPS (1E-9)
#define PI ((long double)3.14159265358979311600)

#define reunique(container) ((container).resize(unique(all(container))-begin(container)))

/*TYPES*/
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;

/*TEMPLATE FUNCTIONS*/
//BIT OPERATIONS
template<typename T> inline int checkbit(T n, T i){return ((n >> i) & T(1));}
inline int bits_count(int v){ v = v - ((v >> 1) & 0x55555555); v = (v & 0x33333333) + ((v >> 2) & 0x33333333); return((v + (v >> 4) & 0xF0F0F0F) * 0x1010101) >> 24; }
inline int bits_count(ll v){ int t = v >> 32; int p = (v & ((1LL << 32) - 1)); return bits_count(t) + bits_count(p); }
unsigned int reverse_bits(register unsigned int x){ x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1)); x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2)); x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4)); x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8)); return((x >> 16) | (x << 16)); }
template<typename T> inline bool isPowerOfTwo(T n){return (n != 0 and ((n&(n-1)) == 0)); }
inline int binlog(int n){ assert(n > 0); return 32-__builtin_clz(n)-1; }
inline int binlog(ll n) { assert(n > 0); return 64-__builtin_clzll(n)-1;  }

void bitprint(int n, int w=32){ for (int i = w-1; i >= 0; i--) { cout << checkbit(n, i); } cout << "\n"; }
void bitprint(ll n, int w=64){ for (ll i = w-1; i >= 0; i--) { cout << checkbit(n, i); } cout << "\n"; }

/*TEMPLATE ALGORITHMS*/
template<typename T> inline T sqr(T x){T x_ = (x); return x_*x_;}
template<typename T> inline T qbr(T x){T x_ = (x); return ((x_*x_)*x_);}
template<typename T> inline int sign(T x){T x_ = (x); return ((x_>T(0))-(x_<T(0)));}
template<typename T> inline T mod(T x, T m){T x_ = (x); return (((x_) >= 0) ? ((x_) % (m)) : ((((x_) % (m))+(m))%(m)));}
template<typename T> inline T gcd(T a, T b){while(b){T t = a % b; a = b; b = t;} return a;}
template<typename T> inline T gcd_ex(T a, T b, T& x, T& y){if(b==0){x=1,y=0; return a;}T x1, y1;T d=gcd_ex(b,a%b,x1,y1);x = y1;y = x1-(a/b)*y1;return d;}
template<typename T> inline T lcm(T a, T b){return (a*(b/gcd(a, b)));}
template<typename A, typename B, typename C>
function<C(A)> combine(function<B(A)> f, function<C(B)> g) {
    return bind(g, bind(f, placeholders::_1));
}

/*COMBINATORS*/
template <typename Collection, typename UnaryOperation> void foreach(Collection &col, UnaryOperation op){for_each(all(col), op);}
template <typename Collection, typename UnaryOperation> Collection fmap(Collection &col, UnaryOperation op){transform(all(col), col.begin(), op); return col;}
template <typename Collection, typename binop> Collection zip(Collection& fc, Collection& sc,binop op) {transform(all(fc), sc.begin(), fc.begin(), op); return fc;}
template <typename Collection, typename Condition> bool exists(Collection& col,Condition con) {auto exist = find_if(all(col), con); return exist != col.end();}
template <typename Collection, typename Predicate> Collection filterNot(Collection& col, Predicate predicate) {auto returnIterator = remove_if(all(col), predicate); col.erase(returnIterator, end(col)); return col;}

//STL INPUT
void fastIO(){ ios::sync_with_stdio(false); cin.tie(nullptr); }
template<class T1, class T2> istream& operator >>(istream& in, pair<T1, T2>& P){in >> P.fst >> P.scd; return in;}
template<class T> istream& operator >>(istream& in, vector<T>& Col){for(auto &el : Col) in >> el; return in;}
template<class T> inline void getarr(T* arr, int l, int r) { in_range(i, l, r) cin >> arr[i]; }

//STL OUTPUT
template<class T1, class T2> ostream& operator <<(ostream& os, const pair<T1, T2>& p){os << "(" << p.fst << ", " << p.scd << ")"; return os;}
template<class T> ostream& operator <<(ostream& os, const vector<vector<T>>& v){for(auto &row : v){ for(auto &el : row) os << el << " "; os << "\n";} return os;}
template<class T> ostream& operator <<(ostream& os, const vector<T>& Col){for(auto &el : Col) os << el << " "; return os;}
template<class T> ostream& operator <<(ostream& os, const set<T>& Col){for(auto &el : Col) os << el << " "; return os;}
template<class T1, class T2> ostream& operator <<(ostream& os, const map<T1, T2>& Col){for(auto &el : Col) os << el << " "; return os;}
template<class T> inline void printarr(T* arr, int l, int r) { in_range(i, l, r) {cout << arr[i] << " ";}; cout << "\n"; }

//VARIADIC INPUT
template<typename First> void read(First& t){ cin >> t; }
template<typename First, typename... Args> void read(First& f, Args&... args){ cin >> f; read(forward<Args&>(args)...); }

//VARIADIC OUTPUT
template<typename T> void print(T&& t){ cout << t << "\n"; }
template<typename First, typename... Args> void print(First&& f, Args&&... args){ cout << f << " "; print(forward<Args&&>(args)...); }
template<typename T> void printLn(T&& t){ cout << t << "\n"; }
template<typename First, typename... Args> void printLn(First&& f, Args&&... args){ cout << f << "\n"; printLn(forward<Args&&>(args)...); }

//VARIADIC TYPE DECLARATION
template <typename T, size_t N> struct MakeTensor{ template <typename... Args> static auto tensor(size_t first, Args... sizes) -> vector<decltype(MakeTensor<T, N-1>::tensor(sizes...))> { auto inner = MakeTensor<T, N-1>::tensor(sizes...); return vector<decltype(inner)>(first, inner);} };
template <typename T> struct MakeTensor<T, 1> { static vector<T> tensor(size_t size) { return vector<T>(size); }};
template <typename T, typename... Args> auto tensor(Args... args) -> decltype(MakeTensor<T, sizeof...(Args)>::tensor(args...)){ return MakeTensor<T, sizeof...(Args)>::tensor(args...); }

//__int128 -- use if supported
//typedef __int128 bigInt;
//istream& operator >>(istream& in, bigInt& n){
//    in >> ws; n = 0;
//    for(char ch = getchar(); isdigit(ch); ch = getchar()){
//        n = n*bigInt(10) + bigInt(ch-'0');
//    }
//    return in;
//}
//ostream& operator <<(ostream& out, bigInt n){
//    int digits[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
//    int representation[36];
//    int pos = 0;
//    while(n){
//        representation[pos++] = digits[n % 10];
//        n /= 10;
//    }
//    for(int i = pos-1; i >= 0; i--){
//        out << representation[i];
//    }
//    return out;
//}

//DEBUG
#define VA_NUM_ARGS(...) VA_NUM_ARGS_IMPL_((0,__VA_ARGS__, 5,4,3,2,1))
#define VA_NUM_ARGS_IMPL_(tuple) VA_NUM_ARGS_IMPL tuple
#define VA_NUM_ARGS_IMPL(_0,_1,_2,_3,_4,_5,N,...) N
#define macro_dispatcher(macro, ...) macro_dispatcher_(macro, VA_NUM_ARGS(__VA_ARGS__))
#define macro_dispatcher_(macro, nargs) macro_dispatcher__(macro, nargs)
#define macro_dispatcher__(macro, nargs) macro_dispatcher___(macro, nargs)
#define macro_dispatcher___(macro, nargs) macro ## nargs
#define DBN1(a)         cerr<<#a<<" = "<<(a)<<"\n"
#define DBN2(a,b)       cerr<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<"\n"
#define DBN3(a,b,c)     cerr<<#a<<" = "<<(a)<<", "<<#b<<" = " <<(b)<<", "<<#c<<" = "<<(c)<<"\n"
#define DBN4(a,b,c,d)   cerr<<#a<<" = "<<(a)<<", "<<#b<<" ="<<(b)<<", "<<#c<<" = "<<(c)<<", "<<#d<<"="<<(d)<<"\n"
#define DBN5(a,b,c,d,e) cerr<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<", "<<#d<<"="<<(d)<<", "<<#e<<"="<<(e)<<"\n"
#define DBN(...) macro_dispatcher(DBN, __VA_ARGS__)(__VA_ARGS__)

#define DEBUG

//EXTREMELY FAST I/O
//const int BUFFSIZE = 2048;
//static char inbuff[BUFFSIZE + 16];
//static char *inp = inbuff;
//static char *linp = inbuff + BUFFSIZE;

// int read_int(){
//  while (*inp && (*inp < '0' || *inp > '9') && *inp != '-') ++inp;
//  bool minus = false;
//  if (*inp == '-') minus = true, ++inp;
//  if (*inp == 0) {
//      memset(inbuff, 0, BUFFSIZE);
//      cin.read(inbuff, BUFFSIZE);
//      inp = inbuff;
//  }
//  int res = *inp++ - '0';
//  if (inp == linp) {
//      memset(inbuff, 0, BUFFSIZE);
//      cin.read(inbuff, BUFFSIZE);
//      inp = inbuff;
//  }
//  while (*inp >= '0' && *inp <= '9') {
//      res = res*10 + *inp - '0';
//      ++inp;
//      if (inp == linp) {
//          memset(inbuff, 0, BUFFSIZE);
//          cin.read(inbuff, BUFFSIZE);
//          inp = inbuff;
//      }
//  }
//  return minus ? -res : res;
// }

//static char outbuff[BUFFSIZE + 16];
//static char *outp = outbuff;
//static char *loutp = outbuff+BUFFSIZE;
//
//void write_int(int x, bool last = false) {
//  char *begp = outp;
//  if (x == 0) {
//        *outp++ = '0';
//  }
//  while(x) {
//      int quot = x/10;
//      char c = x - 10*quot + '0';
//      *outp++ = c;
//      x = quot;
//  }
//  char *endp = outp-1;
//  while(begp < endp) {
//      swap(*begp, *endp);
//      ++begp, --endp;
//  }
////    *outp++ = '\n';
//  if (last || outp > loutp) {
//      cout.write(outbuff, outp - outbuff);
//      outp/= outbuff;
//  }
//}

template<int N, char Aa = '0', char Az = '9'>
struct AhoCorasick{
const static int A = Az-Aa+1;
    int trie[N][A];
    int size = 0;
    int end[N], link[N], endLink[N];

    int add_node() {
        memset(trie[size], 0, A * sizeof(int));
        end[size] = link[size] = endLink[size] = 0;
        return size++;
    }

    AhoCorasick() { init(); }
    void init() { size = 0; add_node(); }
    void add_string(const char* s, int n) {
        int state = 0;
        for (int i = 0; i < n; i++) {
            int c = s[i]-Aa;
            if (!trie[state][c]) trie[state][c] = add_node();
            state = trie[state][c];
        }
        end[state] = n;
    }
    void construct() {
        int queue[N];
        queue[0] = 0;
        for (int *head = queue, *tail = head+1; head != tail; head++) {
            for (int c = 0; c < A; c++) {
                if (trie[*head][c]) {
                    int from = link[*head];
                    while (from != 0 && !trie[from][c]) from = link[from];
                    link[trie[*head][c]] = *head == 0 ? 0 : trie[from][c];
                    *tail++ = trie[*head][c];
                } else {
                    trie[*head][c] = trie[link[*head]][c];
                }
                endLink[*head] = end[link[*head]] ? link[*head] : endLink[link[*head]];
            }
        }
    }
};

const int MAXN = 1001, MAXLEN = 51, MAXV = MAXN*MAXLEN/2;
const int MOD = 1e9+7;
char s[MAXN], x[MAXLEN], y[MAXLEN];
AhoCorasick<MAXN> AC;
int dp[MAXLEN][MAXV][8];

int main(){
//    fastIO();
//    freopen("in", "r", stdin);
//    freopen("out", "w", stdout);
    scanf("%s%s%s", s, x, y);
    int n = strlen(s);
    int d = strlen(x);
    int halfd = d/2;
    for (int i = 0; i < n-halfd+1; i++) {
        AC.add_string(s+i, halfd);
    }
    AC.construct();
    dp[0][0][3] = 1;
    for (int len = 0; len < d; len++) {
        for (int v = 0; v < AC.size; v++) {
            for (int mask = 0; mask < 8; mask++) {
                if (dp[len][v][mask]) {
                    for (int c = 0; c < 10; c++) {
                        int newmask = mask&4;
                        if (mask & 1) {
                            if (x[len]-'0' > c) continue;
                            if (x[len]-'0' == c) newmask |= 1;
                        }
                        if (mask & 2) {
                            if (y[len]-'0' < c) continue;
                            if (y[len]-'0' == c) newmask |= 2;
                        }
                        int u = AC.trie[v][c];
                        if (AC.end[u]) newmask |= 4;
                        int &res = dp[len+1][u][newmask];
                        res += dp[len][v][mask];
                        if (res >= MOD) res -= MOD;
                    }
                }
            }
        }
    }
    int answ = 0;
    for (int v = 0; v < AC.size; v++) {
        for (int mask = 0; mask < 4; mask++) {
            answ += dp[d][v][mask|4];
            if (answ >= MOD) answ -= MOD;
        }
    }
    printf("%d\n", answ);
    return 0;
}


#define _CRT_DISABLE_PERFCRIT_LOCKS
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

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

/*MACROS*/
//FUNCTIONS
#define in_range(i, l, r) for(ll i = l; i < r; i++)

#define all(v) begin(v), end(v)
#define rall(v) (v).rbegin(), (v).rend()

#define tr(it, container) for(auto it = begin(container); it != end(container); it++)
#define rtr(it, container) for(auto it = (container).rbegin(); it != (container).rend(); it++)

#define present(element, container) ((container).find(element) != end(container))

#define _T(...) __VA_ARGS__
#define forever() for(;;)

//ABBREVIATIONS
#define sz(c) (ll(c.size()))
#define pb push_back
#define fst first
#define scd second
#define cmpBy(T, field) [](const T& x, const T& y){ return x.field < y.field; }

//TYPE SAFETY
#define sqrt(x) sqrt(1.0*(x))
#define pow(x, n) pow(1.0*(x), n)

//CONSTANTS
#define INF (numeric_limits<int>::max())
#define MINF (numeric_limits<int>::min())
#define LINF (numeric_limits<long long>::max())
#define LMINF (numeric_limits<long long>::min())
#define EPS (1E-9)
#define PI ((long double)3.14159265358979311600)

#define reunique(container) ((container).resize(unique(all(container))-begin(container)))

/*TYPES*/
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;

/*TEMPLATE FUNCTIONS*/
//BIT OPERATIONS
template<typename T> inline int checkbit(T n, T i){return ((n >> i) & T(1));}
inline int bits_count(int v){ v = v - ((v >> 1) & 0x55555555); v = (v & 0x33333333) + ((v >> 2) & 0x33333333); return((v + (v >> 4) & 0xF0F0F0F) * 0x1010101) >> 24; }
inline int bits_count(ll v){ int t = v >> 32; int p = (v & ((1LL << 32) - 1)); return bits_count(t) + bits_count(p); }
unsigned int reverse_bits(register unsigned int x){ x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1)); x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2)); x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4)); x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8)); return((x >> 16) | (x << 16)); }
template<typename T> inline bool isPowerOfTwo(T n){return (n != 0 and ((n&(n-1)) == 0)); }
inline int binlog(int n){ assert(n > 0); return 32-__builtin_clz(n)-1; }
inline int binlog(ll n) { assert(n > 0); return 64-__builtin_clzll(n)-1;  }

void bitprint(int n, int w=32){ for (int i = w-1; i >= 0; i--) { cout << checkbit(n, i); } cout << "\n"; }
void bitprint(ll n, int w=64){ for (ll i = w-1; i >= 0; i--) { cout << checkbit(n, i); } cout << "\n"; }

/*TEMPLATE ALGORITHMS*/
template<typename T> inline T sqr(T x){T x_ = (x); return x_*x_;}
template<typename T> inline T qbr(T x){T x_ = (x); return ((x_*x_)*x_);}
template<typename T> inline int sign(T x){T x_ = (x); return ((x_>T(0))-(x_<T(0)));}
template<typename T> inline T mod(T x, T m){T x_ = (x); return (((x_) >= 0) ? ((x_) % (m)) : ((((x_) % (m))+(m))%(m)));}
template<typename T> inline T gcd(T a, T b){while(b){T t = a % b; a = b; b = t;} return a;}
template<typename T> inline T gcd_ex(T a, T b, T& x, T& y){if(b==0){x=1,y=0; return a;}T x1, y1;T d=gcd_ex(b,a%b,x1,y1);x = y1;y = x1-(a/b)*y1;return d;}
template<typename T> inline T lcm(T a, T b){return (a*(b/gcd(a, b)));}
template<typename A, typename B, typename C>
function<C(A)> combine(function<B(A)> f, function<C(B)> g) {
    return bind(g, bind(f, placeholders::_1));
}

/*COMBINATORS*/
template <typename Collection, typename UnaryOperation> void foreach(Collection &col, UnaryOperation op){for_each(all(col), op);}
template <typename Collection, typename UnaryOperation> Collection fmap(Collection &col, UnaryOperation op){transform(all(col), col.begin(), op); return col;}
template <typename Collection, typename binop> Collection zip(Collection& fc, Collection& sc,binop op) {transform(all(fc), sc.begin(), fc.begin(), op); return fc;}
template <typename Collection, typename Condition> bool exists(Collection& col,Condition con) {auto exist = find_if(all(col), con); return exist != col.end();}
template <typename Collection, typename Predicate> Collection filterNot(Collection& col, Predicate predicate) {auto returnIterator = remove_if(all(col), predicate); col.erase(returnIterator, end(col)); return col;}

//STL INPUT
void fastIO(){ ios::sync_with_stdio(false); cin.tie(nullptr); }
template<class T1, class T2> istream& operator >>(istream& in, pair<T1, T2>& P){in >> P.fst >> P.scd; return in;}
template<class T> istream& operator >>(istream& in, vector<T>& Col){for(auto &el : Col) in >> el; return in;}
template<class T> inline void getarr(T* arr, int l, int r) { in_range(i, l, r) cin >> arr[i]; }

//STL OUTPUT
template<class T1, class T2> ostream& operator <<(ostream& os, const pair<T1, T2>& p){os << "(" << p.fst << ", " << p.scd << ")"; return os;}
template<class T> ostream& operator <<(ostream& os, const vector<vector<T>>& v){for(auto &row : v){ for(auto &el : row) os << el << " "; os << "\n";} return os;}
template<class T> ostream& operator <<(ostream& os, const vector<T>& Col){for(auto &el : Col) os << el << " "; return os;}
template<class T> ostream& operator <<(ostream& os, const set<T>& Col){for(auto &el : Col) os << el << " "; return os;}
template<class T1, class T2> ostream& operator <<(ostream& os, const map<T1, T2>& Col){for(auto &el : Col) os << el << " "; return os;}
template<class T> inline void printarr(T* arr, int l, int r) { in_range(i, l, r) {cout << arr[i] << " ";}; cout << "\n"; }

//VARIADIC INPUT
template<typename First> void read(First& t){ cin >> t; }
template<typename First, typename... Args> void read(First& f, Args&... args){ cin >> f; read(forward<Args&>(args)...); }

//VARIADIC OUTPUT
template<typename T> void print(T&& t){ cout << t << "\n"; }
template<typename First, typename... Args> void print(First&& f, Args&&... args){ cout << f << " "; print(forward<Args&&>(args)...); }
template<typename T> void printLn(T&& t){ cout << t << "\n"; }
template<typename First, typename... Args> void printLn(First&& f, Args&&... args){ cout << f << "\n"; printLn(forward<Args&&>(args)...); }

//VARIADIC TYPE DECLARATION
template <typename T, size_t N> struct MakeTensor{ template <typename... Args> static auto tensor(size_t first, Args... sizes) -> vector<decltype(MakeTensor<T, N-1>::tensor(sizes...))> { auto inner = MakeTensor<T, N-1>::tensor(sizes...); return vector<decltype(inner)>(first, inner);} };
template <typename T> struct MakeTensor<T, 1> { static vector<T> tensor(size_t size) { return vector<T>(size); }};
template <typename T, typename... Args> auto tensor(Args... args) -> decltype(MakeTensor<T, sizeof...(Args)>::tensor(args...)){ return MakeTensor<T, sizeof...(Args)>::tensor(args...); }

//__int128 -- use if supported
//typedef __int128 bigInt;
//istream& operator >>(istream& in, bigInt& n){
//    in >> ws; n = 0;
//    for(char ch = getchar(); isdigit(ch); ch = getchar()){
//        n = n*bigInt(10) + bigInt(ch-'0');
//    }
//    return in;
//}
//ostream& operator <<(ostream& out, bigInt n){
//    int digits[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
//    int representation[36];
//    int pos = 0;
//    while(n){
//        representation[pos++] = digits[n % 10];
//        n /= 10;
//    }
//    for(int i = pos-1; i >= 0; i--){
//        out << representation[i];
//    }
//    return out;
//}

//DEBUG
#define VA_NUM_ARGS(...) VA_NUM_ARGS_IMPL_((0,__VA_ARGS__, 5,4,3,2,1))
#define VA_NUM_ARGS_IMPL_(tuple) VA_NUM_ARGS_IMPL tuple
#define VA_NUM_ARGS_IMPL(_0,_1,_2,_3,_4,_5,N,...) N
#define macro_dispatcher(macro, ...) macro_dispatcher_(macro, VA_NUM_ARGS(__VA_ARGS__))
#define macro_dispatcher_(macro, nargs) macro_dispatcher__(macro, nargs)
#define macro_dispatcher__(macro, nargs) macro_dispatcher___(macro, nargs)
#define macro_dispatcher___(macro, nargs) macro ## nargs
#define DBN1(a)         cerr<<#a<<" = "<<(a)<<"\n"
#define DBN2(a,b)       cerr<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<"\n"
#define DBN3(a,b,c)     cerr<<#a<<" = "<<(a)<<", "<<#b<<" = " <<(b)<<", "<<#c<<" = "<<(c)<<"\n"
#define DBN4(a,b,c,d)   cerr<<#a<<" = "<<(a)<<", "<<#b<<" ="<<(b)<<", "<<#c<<" = "<<(c)<<", "<<#d<<"="<<(d)<<"\n"
#define DBN5(a,b,c,d,e) cerr<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<", "<<#d<<"="<<(d)<<", "<<#e<<"="<<(e)<<"\n"
#define DBN(...) macro_dispatcher(DBN, __VA_ARGS__)(__VA_ARGS__)

#define DEBUG

//EXTREMELY FAST I/O
//const int BUFFSIZE = 2048;
//static char inbuff[BUFFSIZE + 16];
//static char *inp = inbuff;
//static char *linp = inbuff + BUFFSIZE;

// int read_int(){
//  while (*inp && (*inp < '0' || *inp > '9') && *inp != '-') ++inp;
//  bool minus = false;
//  if (*inp == '-') minus = true, ++inp;
//  if (*inp == 0) {
//      memset(inbuff, 0, BUFFSIZE);
//      cin.read(inbuff, BUFFSIZE);
//      inp = inbuff;
//  }
//  int res = *inp++ - '0';
//  if (inp == linp) {
//      memset(inbuff, 0, BUFFSIZE);
//      cin.read(inbuff, BUFFSIZE);
//      inp = inbuff;
//  }
//  while (*inp >= '0' && *inp <= '9') {
//      res = res*10 + *inp - '0';
//      ++inp;
//      if (inp == linp) {
//          memset(inbuff, 0, BUFFSIZE);
//          cin.read(inbuff, BUFFSIZE);
//          inp = inbuff;
//      }
//  }
//  return minus ? -res : res;
// }

//static char outbuff[BUFFSIZE + 16];
//static char *outp = outbuff;
//static char *loutp = outbuff+BUFFSIZE;
//
//void write_int(int x, bool last = false) {
//  char *begp = outp;
//  if (x == 0) {
//        *outp++ = '0';
//  }
//  while(x) {
//      int quot = x/10;
//      char c = x - 10*quot + '0';
//      *outp++ = c;
//      x = quot;
//  }
//  char *endp = outp-1;
//  while(begp < endp) {
//      swap(*begp, *endp);
//      ++begp, --endp;
//  }
////    *outp++ = '\n';
//  if (last || outp > loutp) {
//      cout.write(outbuff, outp - outbuff);
//      outp/= outbuff;
//  }
//}

template<int N, char Aa = '0', char Az = '9'>
struct AhoCorasick{
const static int A = Az-Aa+1;
    int trie[N][A];
    int size = 0;
    bool end[N];
    int link[N];
    int queue[N];

    int add_node() {
        memset(trie[size], 0, A * sizeof(int));
        end[size] = link[size] = 0;
        return size++;
    }

    AhoCorasick() { init(); }
    void init() { size = 0; add_node(); }
    void add_string(const char* s, int n) {
        int state = 0;
        for (int i = 0; i < n; i++) {
            int c = s[i]-Aa;
            if (!trie[state][c]) trie[state][c] = add_node();
            state = trie[state][c];
        }
        end[state] = true;
    }
    void construct() {
        queue[0] = 0;
        for (int qa = 0, qb = 1; qa < qb; ++qa) {
            int v = queue[qa];
            for (int c = 0; c < A; c++) {
                if (trie[v][c]) {
                    int u = link[v];
                    while (u != 0 && !trie[u][c]) u = link[u];
                    link[trie[v][c]] = v == 0 ? 0 : trie[u][c];
                    queue[qb++] = trie[v][c];
                } else { trie[v][c] = trie[link[v]][c]; }
            }
        }
    }
};

const int MAXN = 1001, MAXLEN = 51, MAXV = MAXN*MAXLEN/2;
const int MOD = 1e9+7;
char s[MAXN], x[MAXLEN], y[MAXLEN];
AhoCorasick<MAXV> AC;
int dp[MAXLEN][MAXV][8];

int main(){
//    fastIO();
//    freopen("in", "r", stdin);
//    freopen("out", "w", stdout);
    scanf("%s%s%s", s, x, y);
    int n = strlen(s);
    int d = strlen(x);
    int halfd = d/2;
    for (int i = 0; i < n-halfd+1; i++) {
        AC.add_string(s+i, halfd);
    }
    AC.construct();
    dp[0][0][3] = 1;
    for (int len = 0; len < d; len++) {
        for (int v = 0; v < AC.size; v++) {
            for (int mask = 0; mask < 8; mask++) {
                if (dp[len][v][mask]) {
                    for (int c = 0; c < 10; c++) {
                        int newmask = mask&4;
                        if (mask & 1) {
                            if (x[len]-'0' > c) continue;
                            if (x[len]-'0' == c) newmask |= 1;
                        }
                        if (mask & 2) {
                            if (y[len]-'0' < c) continue;
                            if (y[len]-'0' == c) newmask |= 2;
                        }
                        int u = AC.trie[v][c];
                        if (AC.end[u]) newmask |= 4;
                        int &res = dp[len+1][u][newmask];
                        res += dp[len][v][mask];
                        if (res >= MOD) res -= MOD;
                    }
                }
            }
        }
    }
    int answ = 0;
    for (int v = 0; v < AC.size; v++) {
        for (int mask = 0; mask < 4; mask++) {
            answ += dp[d][v][mask|4];
            if (answ >= MOD) answ -= MOD;
        }
    }
    printf("%d\n", answ);
    return 0;
}


#define _CRT_DISABLE_PERFCRIT_LOCKS
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

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

/*MACROS*/
//FUNCTIONS
#define in_range(i, l, r) for(ll i = l; i < r; i++)

#define all(v) begin(v), end(v)
#define rall(v) (v).rbegin(), (v).rend()

#define tr(it, container) for(auto it = begin(container); it != end(container); it++)
#define rtr(it, container) for(auto it = (container).rbegin(); it != (container).rend(); it++)

#define present(element, container) ((container).find(element) != end(container))

#define _T(...) __VA_ARGS__
#define forever() for(;;)

//ABBREVIATIONS
#define sz(c) (ll(c.size()))
#define pb push_back
#define fst first
#define scd second
#define cmpBy(T, field) [](const T& x, const T& y){ return x.field < y.field; }

//TYPE SAFETY
#define sqrt(x) sqrt(1.0*(x))
#define pow(x, n) pow(1.0*(x), n)

//CONSTANTS
#define INF (numeric_limits<int>::max())
#define MINF (numeric_limits<int>::min())
#define LINF (numeric_limits<long long>::max())
#define LMINF (numeric_limits<long long>::min())
#define EPS (1E-9)
#define PI ((long double)3.14159265358979311600)

#define reunique(container) ((container).resize(unique(all(container))-begin(container)))

/*TYPES*/
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;

/*TEMPLATE FUNCTIONS*/
//BIT OPERATIONS
template<typename T> inline int checkbit(T n, T i){return ((n >> i) & T(1));}
inline int bits_count(int v){ v = v - ((v >> 1) & 0x55555555); v = (v & 0x33333333) + ((v >> 2) & 0x33333333); return((v + (v >> 4) & 0xF0F0F0F) * 0x1010101) >> 24; }
inline int bits_count(ll v){ int t = v >> 32; int p = (v & ((1LL << 32) - 1)); return bits_count(t) + bits_count(p); }
unsigned int reverse_bits(register unsigned int x){ x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1)); x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2)); x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4)); x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8)); return((x >> 16) | (x << 16)); }
template<typename T> inline bool isPowerOfTwo(T n){return (n != 0 and ((n&(n-1)) == 0)); }
inline int binlog(int n){ assert(n > 0); return 32-__builtin_clz(n)-1; }
inline int binlog(ll n) { assert(n > 0); return 64-__builtin_clzll(n)-1;  }

void bitprint(int n, int w=32){ for (int i = w-1; i >= 0; i--) { cout << checkbit(n, i); } cout << "\n"; }
void bitprint(ll n, int w=64){ for (ll i = w-1; i >= 0; i--) { cout << checkbit(n, i); } cout << "\n"; }

/*TEMPLATE ALGORITHMS*/
template<typename T> inline T sqr(T x){T x_ = (x); return x_*x_;}
template<typename T> inline T qbr(T x){T x_ = (x); return ((x_*x_)*x_);}
template<typename T> inline int sign(T x){T x_ = (x); return ((x_>T(0))-(x_<T(0)));}
template<typename T> inline T mod(T x, T m){T x_ = (x); return (((x_) >= 0) ? ((x_) % (m)) : ((((x_) % (m))+(m))%(m)));}
template<typename T> inline T gcd(T a, T b){while(b){T t = a % b; a = b; b = t;} return a;}
template<typename T> inline T gcd_ex(T a, T b, T& x, T& y){if(b==0){x=1,y=0; return a;}T x1, y1;T d=gcd_ex(b,a%b,x1,y1);x = y1;y = x1-(a/b)*y1;return d;}
template<typename T> inline T lcm(T a, T b){return (a*(b/gcd(a, b)));}
template<typename A, typename B, typename C>
function<C(A)> combine(function<B(A)> f, function<C(B)> g) {
    return bind(g, bind(f, placeholders::_1));
}

/*COMBINATORS*/
template <typename Collection, typename UnaryOperation> void foreach(Collection &col, UnaryOperation op){for_each(all(col), op);}
template <typename Collection, typename UnaryOperation> Collection fmap(Collection &col, UnaryOperation op){transform(all(col), col.begin(), op); return col;}
template <typename Collection, typename binop> Collection zip(Collection& fc, Collection& sc,binop op) {transform(all(fc), sc.begin(), fc.begin(), op); return fc;}
template <typename Collection, typename Condition> bool exists(Collection& col,Condition con) {auto exist = find_if(all(col), con); return exist != col.end();}
template <typename Collection, typename Predicate> Collection filterNot(Collection& col, Predicate predicate) {auto returnIterator = remove_if(all(col), predicate); col.erase(returnIterator, end(col)); return col;}

//STL INPUT
void fastIO(){ ios::sync_with_stdio(false); cin.tie(nullptr); }
template<class T1, class T2> istream& operator >>(istream& in, pair<T1, T2>& P){in >> P.fst >> P.scd; return in;}
template<class T> istream& operator >>(istream& in, vector<T>& Col){for(auto &el : Col) in >> el; return in;}
template<class T> inline void getarr(T* arr, int l, int r) { in_range(i, l, r) cin >> arr[i]; }

//STL OUTPUT
template<class T1, class T2> ostream& operator <<(ostream& os, const pair<T1, T2>& p){os << "(" << p.fst << ", " << p.scd << ")"; return os;}
template<class T> ostream& operator <<(ostream& os, const vector<vector<T>>& v){for(auto &row : v){ for(auto &el : row) os << el << " "; os << "\n";} return os;}
template<class T> ostream& operator <<(ostream& os, const vector<T>& Col){for(auto &el : Col) os << el << " "; return os;}
template<class T> ostream& operator <<(ostream& os, const set<T>& Col){for(auto &el : Col) os << el << " "; return os;}
template<class T1, class T2> ostream& operator <<(ostream& os, const map<T1, T2>& Col){for(auto &el : Col) os << el << " "; return os;}
template<class T> inline void printarr(T* arr, int l, int r) { in_range(i, l, r) {cout << arr[i] << " ";}; cout << "\n"; }

//VARIADIC INPUT
template<typename First> void read(First& t){ cin >> t; }
template<typename First, typename... Args> void read(First& f, Args&... args){ cin >> f; read(forward<Args&>(args)...); }

//VARIADIC OUTPUT
template<typename T> void print(T&& t){ cout << t << "\n"; }
template<typename First, typename... Args> void print(First&& f, Args&&... args){ cout << f << " "; print(forward<Args&&>(args)...); }
template<typename T> void printLn(T&& t){ cout << t << "\n"; }
template<typename First, typename... Args> void printLn(First&& f, Args&&... args){ cout << f << "\n"; printLn(forward<Args&&>(args)...); }

//VARIADIC TYPE DECLARATION
template <typename T, size_t N> struct MakeTensor{ template <typename... Args> static auto tensor(size_t first, Args... sizes) -> vector<decltype(MakeTensor<T, N-1>::tensor(sizes...))> { auto inner = MakeTensor<T, N-1>::tensor(sizes...); return vector<decltype(inner)>(first, inner);} };
template <typename T> struct MakeTensor<T, 1> { static vector<T> tensor(size_t size) { return vector<T>(size); }};
template <typename T, typename... Args> auto tensor(Args... args) -> decltype(MakeTensor<T, sizeof...(Args)>::tensor(args...)){ return MakeTensor<T, sizeof...(Args)>::tensor(args...); }

//__int128 -- use if supported
//typedef __int128 bigInt;
//istream& operator >>(istream& in, bigInt& n){
//    in >> ws; n = 0;
//    for(char ch = getchar(); isdigit(ch); ch = getchar()){
//        n = n*bigInt(10) + bigInt(ch-'0');
//    }
//    return in;
//}
//ostream& operator <<(ostream& out, bigInt n){
//    int digits[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
//    int representation[36];
//    int pos = 0;
//    while(n){
//        representation[pos++] = digits[n % 10];
//        n /= 10;
//    }
//    for(int i = pos-1; i >= 0; i--){
//        out << representation[i];
//    }
//    return out;
//}

//DEBUG
#define VA_NUM_ARGS(...) VA_NUM_ARGS_IMPL_((0,__VA_ARGS__, 5,4,3,2,1))
#define VA_NUM_ARGS_IMPL_(tuple) VA_NUM_ARGS_IMPL tuple
#define VA_NUM_ARGS_IMPL(_0,_1,_2,_3,_4,_5,N,...) N
#define macro_dispatcher(macro, ...) macro_dispatcher_(macro, VA_NUM_ARGS(__VA_ARGS__))
#define macro_dispatcher_(macro, nargs) macro_dispatcher__(macro, nargs)
#define macro_dispatcher__(macro, nargs) macro_dispatcher___(macro, nargs)
#define macro_dispatcher___(macro, nargs) macro ## nargs
#define DBN1(a)         cerr<<#a<<" = "<<(a)<<"\n"
#define DBN2(a,b)       cerr<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<"\n"
#define DBN3(a,b,c)     cerr<<#a<<" = "<<(a)<<", "<<#b<<" = " <<(b)<<", "<<#c<<" = "<<(c)<<"\n"
#define DBN4(a,b,c,d)   cerr<<#a<<" = "<<(a)<<", "<<#b<<" ="<<(b)<<", "<<#c<<" = "<<(c)<<", "<<#d<<"="<<(d)<<"\n"
#define DBN5(a,b,c,d,e) cerr<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<", "<<#d<<"="<<(d)<<", "<<#e<<"="<<(e)<<"\n"
#define DBN(...) macro_dispatcher(DBN, __VA_ARGS__)(__VA_ARGS__)

#define DEBUG

//EXTREMELY FAST I/O
//const int BUFFSIZE = 2048;
//static char inbuff[BUFFSIZE + 16];
//static char *inp = inbuff;
//static char *linp = inbuff + BUFFSIZE;

// int read_int(){
//  while (*inp && (*inp < '0' || *inp > '9') && *inp != '-') ++inp;
//  bool minus = false;
//  if (*inp == '-') minus = true, ++inp;
//  if (*inp == 0) {
//      memset(inbuff, 0, BUFFSIZE);
//      cin.read(inbuff, BUFFSIZE);
//      inp = inbuff;
//  }
//  int res = *inp++ - '0';
//  if (inp == linp) {
//      memset(inbuff, 0, BUFFSIZE);
//      cin.read(inbuff, BUFFSIZE);
//      inp = inbuff;
//  }
//  while (*inp >= '0' && *inp <= '9') {
//      res = res*10 + *inp - '0';
//      ++inp;
//      if (inp == linp) {
//          memset(inbuff, 0, BUFFSIZE);
//          cin.read(inbuff, BUFFSIZE);
//          inp = inbuff;
//      }
//  }
//  return minus ? -res : res;
// }

//static char outbuff[BUFFSIZE + 16];
//static char *outp = outbuff;
//static char *loutp = outbuff+BUFFSIZE;
//
//void write_int(int x, bool last = false) {
//  char *begp = outp;
//  if (x == 0) {
//        *outp++ = '0';
//  }
//  while(x) {
//      int quot = x/10;
//      char c = x - 10*quot + '0';
//      *outp++ = c;
//      x = quot;
//  }
//  char *endp = outp-1;
//  while(begp < endp) {
//      swap(*begp, *endp);
//      ++begp, --endp;
//  }
////    *outp++ = '\n';
//  if (last || outp > loutp) {
//      cout.write(outbuff, outp - outbuff);
//      outp/= outbuff;
//  }
//}

template<int N, char Aa = '0', char Az = '9'>
struct AhoCorasick{
const static int A = Az-Aa+1;
    int trie[N][A];
    int size = 0;
    bool end[N];
    int link[N];
    int queue[N];

    int add_node() {
        memset(trie[size], 0, A * sizeof(int));
        end[size] = link[size] = 0;
        return size++;
    }

    AhoCorasick() { init(); }
    void init() { size = 0; add_node(); }
    void add_string(const char* s, int n) {
        int state = 0;
        for (int i = 0; i < n; i++) {
            int c = s[i]-Aa;
            if (!trie[state][c]) trie[state][c] = add_node();
            state = trie[state][c];
        }
        end[state] = true;
    }
    void construct() {
        queue[0] = 0;
        for (int qa = 0, qb = 1; qa != qb; ++qa) {
            int v = queue[qa];
            for (int c = 0; c < A; c++) {
                if (trie[v][c]) {
                    int u = link[v];
                    while (u != 0 && !trie[u][c]) u = link[u];
                    link[trie[v][c]] = v == 0 ? 0 : trie[u][c];
                    queue[qb++] = trie[v][c];
                } else {
                    trie[v][c] = trie[link[v]][c];
                }
            }
        }
    }
};

const int MAXN = 1001, MAXLEN = 51, MAXV = MAXN*MAXLEN/2;
const int MOD = 1e9+7;
char s[MAXN], x[MAXLEN], y[MAXLEN];
AhoCorasick<MAXN> AC;
int dp[MAXLEN][MAXV][8];

int main(){
//    fastIO();
//    freopen("in", "r", stdin);
//    freopen("out", "w", stdout);
    scanf("%s%s%s", s, x, y);
    int n = strlen(s);
    int d = strlen(x);
    int halfd = d/2;
    for (int i = 0; i < n-halfd+1; i++) {
        AC.add_string(s+i, halfd);
    }
    AC.construct();
    dp[0][0][3] = 1;
    for (int len = 0; len < d; len++) {
        for (int v = 0; v < AC.size; v++) {
            for (int mask = 0; mask < 8; mask++) {
                if (dp[len][v][mask]) {
                    for (int c = 0; c < 10; c++) {
                        int newmask = mask&4;
                        if (mask & 1) {
                            if (x[len]-'0' > c) continue;
                            if (x[len]-'0' == c) newmask |= 1;
                        }
                        if (mask & 2) {
                            if (y[len]-'0' < c) continue;
                            if (y[len]-'0' == c) newmask |= 2;
                        }
                        int u = AC.trie[v][c];
                        if (AC.end[u]) newmask |= 4;
                        int &res = dp[len+1][u][newmask];
                        res += dp[len][v][mask];
                        if (res >= MOD) res -= MOD;
                    }
                }
            }
        }
    }
    int answ = 0;
    for (int v = 0; v < AC.size; v++) {
        for (int mask = 0; mask < 4; mask++) {
            answ += dp[d][v][mask|4];
            if (answ >= MOD) answ -= MOD;
        }
    }
    printf("%d\n", answ);
    return 0;
}


#define _CRT_DISABLE_PERFCRIT_LOCKS
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

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

/*MACROS*/
//FUNCTIONS
#define in_range(i, l, r) for(ll i = l; i < r; i++)

#define all(v) begin(v), end(v)
#define rall(v) (v).rbegin(), (v).rend()

#define tr(it, container) for(auto it = begin(container); it != end(container); it++)
#define rtr(it, container) for(auto it = (container).rbegin(); it != (container).rend(); it++)

#define present(element, container) ((container).find(element) != end(container))

#define _T(...) __VA_ARGS__
#define forever() for(;;)

//ABBREVIATIONS
#define sz(c) (ll(c.size()))
#define pb push_back
#define fst first
#define scd second
#define cmpBy(T, field) [](const T& x, const T& y){ return x.field < y.field; }

//TYPE SAFETY
#define sqrt(x) sqrt(1.0*(x))
#define pow(x, n) pow(1.0*(x), n)

//CONSTANTS
#define INF (numeric_limits<int>::max())
#define MINF (numeric_limits<int>::min())
#define LINF (numeric_limits<long long>::max())
#define LMINF (numeric_limits<long long>::min())
#define EPS (1E-9)
#define PI ((long double)3.14159265358979311600)

#define reunique(container) ((container).resize(unique(all(container))-begin(container)))

/*TYPES*/
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;

/*TEMPLATE FUNCTIONS*/
//BIT OPERATIONS
template<typename T> inline int checkbit(T n, T i){return ((n >> i) & T(1));}
inline int bits_count(int v){ v = v - ((v >> 1) & 0x55555555); v = (v & 0x33333333) + ((v >> 2) & 0x33333333); return((v + (v >> 4) & 0xF0F0F0F) * 0x1010101) >> 24; }
inline int bits_count(ll v){ int t = v >> 32; int p = (v & ((1LL << 32) - 1)); return bits_count(t) + bits_count(p); }
unsigned int reverse_bits(register unsigned int x){ x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1)); x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2)); x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4)); x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8)); return((x >> 16) | (x << 16)); }
template<typename T> inline bool isPowerOfTwo(T n){return (n != 0 and ((n&(n-1)) == 0)); }
inline int binlog(int n){ assert(n > 0); return 32-__builtin_clz(n)-1; }
inline int binlog(ll n) { assert(n > 0); return 64-__builtin_clzll(n)-1;  }

void bitprint(int n, int w=32){ for (int i = w-1; i >= 0; i--) { cout << checkbit(n, i); } cout << "\n"; }
void bitprint(ll n, int w=64){ for (ll i = w-1; i >= 0; i--) { cout << checkbit(n, i); } cout << "\n"; }

/*TEMPLATE ALGORITHMS*/
template<typename T> inline T sqr(T x){T x_ = (x); return x_*x_;}
template<typename T> inline T qbr(T x){T x_ = (x); return ((x_*x_)*x_);}
template<typename T> inline int sign(T x){T x_ = (x); return ((x_>T(0))-(x_<T(0)));}
template<typename T> inline T mod(T x, T m){T x_ = (x); return (((x_) >= 0) ? ((x_) % (m)) : ((((x_) % (m))+(m))%(m)));}
template<typename T> inline T gcd(T a, T b){while(b){T t = a % b; a = b; b = t;} return a;}
template<typename T> inline T gcd_ex(T a, T b, T& x, T& y){if(b==0){x=1,y=0; return a;}T x1, y1;T d=gcd_ex(b,a%b,x1,y1);x = y1;y = x1-(a/b)*y1;return d;}
template<typename T> inline T lcm(T a, T b){return (a*(b/gcd(a, b)));}
template<typename A, typename B, typename C>
function<C(A)> combine(function<B(A)> f, function<C(B)> g) {
    return bind(g, bind(f, placeholders::_1));
}

/*COMBINATORS*/
template <typename Collection, typename UnaryOperation> void foreach(Collection &col, UnaryOperation op){for_each(all(col), op);}
template <typename Collection, typename UnaryOperation> Collection fmap(Collection &col, UnaryOperation op){transform(all(col), col.begin(), op); return col;}
template <typename Collection, typename binop> Collection zip(Collection& fc, Collection& sc,binop op) {transform(all(fc), sc.begin(), fc.begin(), op); return fc;}
template <typename Collection, typename Condition> bool exists(Collection& col,Condition con) {auto exist = find_if(all(col), con); return exist != col.end();}
template <typename Collection, typename Predicate> Collection filterNot(Collection& col, Predicate predicate) {auto returnIterator = remove_if(all(col), predicate); col.erase(returnIterator, end(col)); return col;}

//STL INPUT
void fastIO(){ ios::sync_with_stdio(false); cin.tie(nullptr); }
template<class T1, class T2> istream& operator >>(istream& in, pair<T1, T2>& P){in >> P.fst >> P.scd; return in;}
template<class T> istream& operator >>(istream& in, vector<T>& Col){for(auto &el : Col) in >> el; return in;}
template<class T> inline void getarr(T* arr, int l, int r) { in_range(i, l, r) cin >> arr[i]; }

//STL OUTPUT
template<class T1, class T2> ostream& operator <<(ostream& os, const pair<T1, T2>& p){os << "(" << p.fst << ", " << p.scd << ")"; return os;}
template<class T> ostream& operator <<(ostream& os, const vector<vector<T>>& v){for(auto &row : v){ for(auto &el : row) os << el << " "; os << "\n";} return os;}
template<class T> ostream& operator <<(ostream& os, const vector<T>& Col){for(auto &el : Col) os << el << " "; return os;}
template<class T> ostream& operator <<(ostream& os, const set<T>& Col){for(auto &el : Col) os << el << " "; return os;}
template<class T1, class T2> ostream& operator <<(ostream& os, const map<T1, T2>& Col){for(auto &el : Col) os << el << " "; return os;}
template<class T> inline void printarr(T* arr, int l, int r) { in_range(i, l, r) {cout << arr[i] << " ";}; cout << "\n"; }

//VARIADIC INPUT
template<typename First> void read(First& t){ cin >> t; }
template<typename First, typename... Args> void read(First& f, Args&... args){ cin >> f; read(forward<Args&>(args)...); }

//VARIADIC OUTPUT
template<typename T> void print(T&& t){ cout << t << "\n"; }
template<typename First, typename... Args> void print(First&& f, Args&&... args){ cout << f << " "; print(forward<Args&&>(args)...); }
template<typename T> void printLn(T&& t){ cout << t << "\n"; }
template<typename First, typename... Args> void printLn(First&& f, Args&&... args){ cout << f << "\n"; printLn(forward<Args&&>(args)...); }

//VARIADIC TYPE DECLARATION
template <typename T, size_t N> struct MakeTensor{ template <typename... Args> static auto tensor(size_t first, Args... sizes) -> vector<decltype(MakeTensor<T, N-1>::tensor(sizes...))> { auto inner = MakeTensor<T, N-1>::tensor(sizes...); return vector<decltype(inner)>(first, inner);} };
template <typename T> struct MakeTensor<T, 1> { static vector<T> tensor(size_t size) { return vector<T>(size); }};
template <typename T, typename... Args> auto tensor(Args... args) -> decltype(MakeTensor<T, sizeof...(Args)>::tensor(args...)){ return MakeTensor<T, sizeof...(Args)>::tensor(args...); }

//__int128 -- use if supported
//typedef __int128 bigInt;
//istream& operator >>(istream& in, bigInt& n){
//    in >> ws; n = 0;
//    for(char ch = getchar(); isdigit(ch); ch = getchar()){
//        n = n*bigInt(10) + bigInt(ch-'0');
//    }
//    return in;
//}
//ostream& operator <<(ostream& out, bigInt n){
//    int digits[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
//    int representation[36];
//    int pos = 0;
//    while(n){
//        representation[pos++] = digits[n % 10];
//        n /= 10;
//    }
//    for(int i = pos-1; i >= 0; i--){
//        out << representation[i];
//    }
//    return out;
//}

//DEBUG
#define VA_NUM_ARGS(...) VA_NUM_ARGS_IMPL_((0,__VA_ARGS__, 5,4,3,2,1))
#define VA_NUM_ARGS_IMPL_(tuple) VA_NUM_ARGS_IMPL tuple
#define VA_NUM_ARGS_IMPL(_0,_1,_2,_3,_4,_5,N,...) N
#define macro_dispatcher(macro, ...) macro_dispatcher_(macro, VA_NUM_ARGS(__VA_ARGS__))
#define macro_dispatcher_(macro, nargs) macro_dispatcher__(macro, nargs)
#define macro_dispatcher__(macro, nargs) macro_dispatcher___(macro, nargs)
#define macro_dispatcher___(macro, nargs) macro ## nargs
#define DBN1(a)         cerr<<#a<<" = "<<(a)<<"\n"
#define DBN2(a,b)       cerr<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<"\n"
#define DBN3(a,b,c)     cerr<<#a<<" = "<<(a)<<", "<<#b<<" = " <<(b)<<", "<<#c<<" = "<<(c)<<"\n"
#define DBN4(a,b,c,d)   cerr<<#a<<" = "<<(a)<<", "<<#b<<" ="<<(b)<<", "<<#c<<" = "<<(c)<<", "<<#d<<"="<<(d)<<"\n"
#define DBN5(a,b,c,d,e) cerr<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<", "<<#d<<"="<<(d)<<", "<<#e<<"="<<(e)<<"\n"
#define DBN(...) macro_dispatcher(DBN, __VA_ARGS__)(__VA_ARGS__)

#define DEBUG

//EXTREMELY FAST I/O
//const int BUFFSIZE = 2048;
//static char inbuff[BUFFSIZE + 16];
//static char *inp = inbuff;
//static char *linp = inbuff + BUFFSIZE;

// int read_int(){
//  while (*inp && (*inp < '0' || *inp > '9') && *inp != '-') ++inp;
//  bool minus = false;
//  if (*inp == '-') minus = true, ++inp;
//  if (*inp == 0) {
//      memset(inbuff, 0, BUFFSIZE);
//      cin.read(inbuff, BUFFSIZE);
//      inp = inbuff;
//  }
//  int res = *inp++ - '0';
//  if (inp == linp) {
//      memset(inbuff, 0, BUFFSIZE);
//      cin.read(inbuff, BUFFSIZE);
//      inp = inbuff;
//  }
//  while (*inp >= '0' && *inp <= '9') {
//      res = res*10 + *inp - '0';
//      ++inp;
//      if (inp == linp) {
//          memset(inbuff, 0, BUFFSIZE);
//          cin.read(inbuff, BUFFSIZE);
//          inp = inbuff;
//      }
//  }
//  return minus ? -res : res;
// }

//static char outbuff[BUFFSIZE + 16];
//static char *outp = outbuff;
//static char *loutp = outbuff+BUFFSIZE;
//
//void write_int(int x, bool last = false) {
//  char *begp = outp;
//  if (x == 0) {
//        *outp++ = '0';
//  }
//  while(x) {
//      int quot = x/10;
//      char c = x - 10*quot + '0';
//      *outp++ = c;
//      x = quot;
//  }
//  char *endp = outp-1;
//  while(begp < endp) {
//      swap(*begp, *endp);
//      ++begp, --endp;
//  }
////    *outp++ = '\n';
//  if (last || outp > loutp) {
//      cout.write(outbuff, outp - outbuff);
//      outp/= outbuff;
//  }
//}

template<int N, char Aa = '0', char Az = '9'>
struct AhoCorasick{
const static int A = Az-Aa+1;
    int trie[N][A];
    int size = 0;
    bool end[N];
    int link[N];
    int queue[N];

    int add_node() {
        memset(trie[size], 0, A * sizeof(int));
        end[size] = link[size] = 0;
        return size++;
    }

    AhoCorasick() { init(); }
    void init() { size = 0; add_node(); }
    void add_string(const char* s, int n) {
        int state = 0;
        for (int i = 0; i < n; i++) {
            int c = s[i]-Aa;
            if (!trie[state][c]) trie[state][c] = add_node();
            state = trie[state][c];
        }
        end[state] = true;
    }
    void construct() {
        queue[0] = 0;
        for (int *head = queue, *tail = head+1; head != tail; head++) {
            for (int c = 0; c < A; c++) {
                if (trie[*head][c]) {
                    int from = link[*head];
                    while (from != 0 && !trie[from][c]) from = link[from];
                    link[trie[*head][c]] = *head == 0 ? 0 : trie[from][c];
                    *tail++ = trie[*head][c];
                } else {
                    trie[*head][c] = trie[link[*head]][c];
                }
            }
        }
    }
};

const int MAXN = 1001, MAXLEN = 51, MAXV = MAXN*MAXLEN/2;
const int MOD = 1e9+7;
char s[MAXN], x[MAXLEN], y[MAXLEN];
AhoCorasick<MAXN> AC;
int dp[MAXLEN][MAXV][8];

int main(){
//    fastIO();
//    freopen("in", "r", stdin);
//    freopen("out", "w", stdout);
    scanf("%s%s%s", s, x, y);
    int n = strlen(s);
    int d = strlen(x);
    int halfd = d/2;
    for (int i = 0; i < n-halfd+1; i++) {
        AC.add_string(s+i, halfd);
    }
    AC.construct();
    dp[0][0][3] = 1;
    for (int len = 0; len < d; len++) {
        for (int v = 0; v < AC.size; v++) {
            for (int mask = 0; mask < 8; mask++) {
                if (dp[len][v][mask]) {
                    for (int c = 0; c < 10; c++) {
                        int newmask = mask&4;
                        if (mask & 1) {
                            if (x[len]-'0' > c) continue;
                            if (x[len]-'0' == c) newmask |= 1;
                        }
                        if (mask & 2) {
                            if (y[len]-'0' < c) continue;
                            if (y[len]-'0' == c) newmask |= 2;
                        }
                        int u = AC.trie[v][c];
                        if (AC.end[u]) newmask |= 4;
                        int &res = dp[len+1][u][newmask];
                        res += dp[len][v][mask];
                        if (res >= MOD) res -= MOD;
                    }
                }
            }
        }
    }
    int answ = 0;
    for (int v = 0; v < AC.size; v++) {
        for (int mask = 0; mask < 4; mask++) {
            answ += dp[d][v][mask|4];
            if (answ >= MOD) answ -= MOD;
        }
    }
    printf("%d\n", answ);
    return 0;
}


#include<bits/stdc++.h>
#define maxn 2010
#define maxd 55
#define mod 1000000007
using namespace std;
template<typename T> inline void read(T &x)
{
    x=0;char c=getchar();bool flag=false;
    while(!isdigit(c)){if(c=='-')flag=true;c=getchar();}
    while(isdigit(c)){x=(x<<1)+(x<<3)+(c^48);c=getchar();}
    if(flag)x=-x;
}
int n,d,tot=1,las=1,root=1,cnt;
int fa[maxn],len[maxn],ch[maxn][12],num[maxn];
int f[maxd][maxn][maxd][2][2];
char s[maxn],a[maxn],b[maxn];
void insert(int c)
{
	int p=las,np=las=++tot;
	len[np]=len[p]+1;
	while(p&&!ch[p][c]) ch[p][c]=np,p=fa[p];
	if(!p) fa[np]=root;
	else
    {
        int q=ch[p][c];
	    if(len[q]==len[p]+1) fa[np]=q;
	    else
	    {
	    	int nq=++tot;
	    	memcpy(ch[nq],ch[q],sizeof(ch[q]));
	    	len[nq]=len[p]+1,fa[nq]=fa[q],fa[np]=fa[q]=nq;
	    	while(ch[p][c]==q) ch[p][c]=nq,p=fa[p];
	    }
    }
}
int dp(int pos,int cur,int lenth,bool lim,bool flag)
{
    if(pos==cnt+1) return flag;
    if(f[pos][cur][lenth][lim][flag]!=-1) return f[pos][cur][lenth][lim][flag];
    int v=0,ma=9;
    if(lim) ma=num[pos];
    for(int c=0;c<=ma;++c)
    {
        if(pos==1&&!c&&ma) continue;
        if(flag) v=(v+dp(pos+1,cur,lenth,lim&&c==ma,1))%mod;
        else
        {
            int p=cur;
            if(ch[p][c]) v=(v+dp(pos+1,ch[p][c],lenth+1,lim&&c==ma,lenth+1>=d/2))%mod;
            else
            {
                while(p&&!ch[p][c]) p=fa[p];
		        if(p) v=(v+dp(pos+1,ch[p][c],len[p]+1,lim&&c==ma,len[p]+1>=d/2))%mod;
		        else v=(v+dp(pos+1,root,0,lim&&c==ma,0))%mod;
            }
        }
    }
    return f[pos][cur][lenth][lim][flag]=v;
}
int solve(char *s)
{
    cnt=strlen(s+1),memset(f,-1,sizeof(f));
    for(int i=1;i<=cnt;++i) num[i]=s[i]-'0';
    return dp(1,root,0,1,0);
}
int main()
{
    scanf("%s%s%s",s+1,a+1,b+1),n=strlen(s+1),d=cnt=strlen(a+1);
    for(int i=1;i<=n;++i) insert(s[i]-'0');
    a[cnt--]--;
    while(a[cnt]-'0'==-1) a[cnt]--,a[cnt--]=9+'0';
    printf("%d",(solve(b)-solve(a)+mod)%mod);
    return 0;
}


#include<bits/stdc++.h>
#define maxn 2010
#define maxd 55
#define mod 1000000007
using namespace std;
template<typename T> inline void read(T &x)
{
    x=0;char c=getchar();bool flag=false;
    while(!isdigit(c)){if(c=='-')flag=true;c=getchar();}
    while(isdigit(c)){x=(x<<1)+(x<<3)+(c^48);c=getchar();}
    if(flag)x=-x;
}
int n,d,tot=1,las=1,root=1,cnt;
int fa[maxn],len[maxn],ch[maxn][12],num[maxn];
int f[maxd][maxn][maxd][2][2][2];
char s[maxn],a[maxn],b[maxn];
void insert(int c)
{
	int p=las,np=las=++tot;
	len[np]=len[p]+1;
	while(p&&!ch[p][c]) ch[p][c]=np,p=fa[p];
	if(!p) fa[np]=root;
	else
    {
        int q=ch[p][c];
	    if(len[q]==len[p]+1) fa[np]=q;
	    else
	    {
	    	int nq=++tot;
	    	memcpy(ch[nq],ch[q],sizeof(ch[q]));
	    	len[nq]=len[p]+1,fa[nq]=fa[q],fa[np]=fa[q]=nq;
	    	while(ch[p][c]==q) ch[p][c]=nq,p=fa[p];
	    }
    }
}
int dp(int pos,int cur,int lenth,bool lim,bool lead,bool flag)
{
    if(!pos) return flag;
    if(f[pos][cur][lenth][lim][lead][flag]!=-1) return f[pos][cur][lenth][lim][lead][flag];
    int v=0,ma=9;
    if(lim) ma=num[pos];
    for(int c=0;c<=ma;++c)
    {
        if(!c&&lead) v=(v+dp(pos-1,cur,lenth,0,1,0));
        else
        {
            int p=0,l=0;
            if(!flag)
            {
                int p=cur,l=lenth;
                while(p&&!ch[p][c]) p=fa[p];
		        if(p) v=(v+dp(pos-1,ch[p][c],len[p]+1,lim&&c==ma,0,len[p]+1>=d/2))%mod;
		        else v=(v+dp(pos-1,root,0,lim&&c==ma,0,0))%mod;
            }
            else v=(v+dp(pos-1,0,0,lim&&c==ma,0,1))%mod;
        }
    }
    return f[pos][cur][lenth][lim][lead][flag]=v;
}
int solve(char *s)
{
    int lenth=strlen(s+1);
    memset(f,-1,sizeof(f));
    for(int i=1;i<=lenth;++i) num[i]=s[i]-'0';
    if(num[lenth]==0) lenth--;
    return dp(lenth,root,0,1,1,0);
}
int main()
{
    scanf("%s%s%s",s+1,a+1,b+1),n=strlen(s+1),d=strlen(a+1);
    reverse(s+1,s+n+1),reverse(a+1,a+d+1),reverse(b+1,b+d+1);
    for(int i=1;i<=n;++i) insert(s[i]-'0');
    a[++cnt]--;
    while(a[cnt]-'0'==-1) a[cnt++]=9+'0',a[cnt]--;
    printf("%d",(solve(b)-solve(a)+mod)%mod);
    return 0;
}


import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int p ,q, count = 0, k = 0;
        int[] nMass = new int[n+1];
        int[] pMass = new int[n+1];
        int[] qMass = new int[n+1];
        int[] commonMass = new int[n+1];

        p = sc.nextInt();

        for(int i = 0; i < n+1; i++){
            if(i == k){
                count++;
                pMass[i] = i;
                if( count == p) break;
                k = sc.nextInt();
            }
        }
        count = 0;

        q = sc.nextInt();

        for(int i = 0; i < n+1; i++){
            if(i == k){
                count++;
                qMass[i] = i;
                if( count == q) break;
                k = sc.nextInt();
            }
        }

        for(int i = 1; i < n+1; i++){
            nMass[i] = i;
        }

        for(int i = 1; i < n+1; i++){
            if(pMass[i] > qMass[i]) {
                commonMass[i] = pMass[i];
            } else if(pMass[i] < qMass[i]){
                commonMass[i] = qMass[i];
            } else {
                commonMass[i] = qMass[i];
            }
        }

        for(int i = 1; i < n+1; i++){
            if(nMass[i] != commonMass[i]){
                System.out.print("Oh, my keyboard!");
                break;
            }
            if(n == i) {
                System.out.print("I become the guy.");
                break;
            }
        }
    }
}


import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] mass = new int[n+1];
        int p = sc.nextInt();
        for (int i = 0; i < p; i++){
            int temp = sc.nextInt();
            mass[temp] = 1;
        }
        int q = sc.nextInt();
        for (int i = 0; i < q; i++){
            int temp = sc.nextInt();
            mass[temp] = 1;
        }

        for (int i = 1; i < n+1; i++){
            if(mass[i] == 0) {
                System.out.println("Oh, my keyboard!");
                return;
            }
        }
        System.out.println("I become the guy.");
    }
}


import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int p ,q, count = 0, k = 0;
        int[] nMass = new int[n+1];
        int[] pMass = new int[n+1];
        int[] qMass = new int[n+1];
        int[] commonMass = new int[n+1];

        p = sc.nextInt();

        for(int i = 0; i < n+1; i++){
            if(i == k){
                pMass[i] = i;
                count++;
                if( count == p+1) break;
                k = sc.nextInt();
            }
        }
        count = 0;
        k = 0;

        q = sc.nextInt();

        for(int i = 0; i < n+1; i++){
            if(i == k){
                count++;
                qMass[i] = i;
                if( count == q+1) break;
                k = sc.nextInt();
            }
        }

        for(int i = 1; i < n+1; i++){
            nMass[i] = i;
        }

        for(int i = 1; i < n+1; i++){
            if(pMass[i] > qMass[i]) {
                commonMass[i] = pMass[i];
            } else if(pMass[i] < qMass[i]){
                commonMass[i] = qMass[i];
            } else {
                commonMass[i] = qMass[i];
            }
        }

        for(int i = 1; i < n+1; i++){
            if(nMass[i] != commonMass[i]){
                System.out.print("Oh, my keyboard!");
                break;
            }
            if(n == i) {
                System.out.print("I become the guy.");
                break;
            }
        }
    }
}