#include<bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)

const ULL M = 1000000007;

ULL F[88];
vector<string> S;

struct Node {
    int to[10];
    int z = 0;
    bool enable = false;
    Node() { rep(i, 10) to[i] = -1; }
};

vector<Node> V;

int main() {
    F[0] = F[1] = 1;
    for (int i = 2; i < 88; i++) F[i] = F[i - 1] + F[i - 2];

    ULL N, L, R; cin >> N >> L >> R;
    rep(i, 88) if (L <= F[i] && F[i] <= R) S.push_back(to_string(F[i]));

    V.push_back(Node());
    for (string& s : S) {
        int p = 0;
        for (char c : s) {
            int d = c - '0';
            if (V[p].to[d] == -1) {
                V[p].to[d] = V.size();
                V.push_back(Node());
            }
            p = V[p].to[d];
        }
        V[p].enable = true;
    }

    queue<int> Q;
    rep(t, 10) {
        if (V[0].to[t] == -1) V[0].to[t] = 0;
        else {
            V[V[0].to[t]].z = 0;
            Q.push(V[0].to[t]);
        }
    }
    while (Q.size()) {
        int q = Q.front(); Q.pop();
        rep(t, 10) {
            if (V[q].to[t] != -1) {
                Q.push(V[q].to[t]);
                int p = V[q].z;
                while (V[p].to[t] == -1) { p = V[p].z; }
                V[V[q].to[t]].enable = V[V[q].to[t]].enable || V[V[p].to[t]].enable;
                V[V[q].to[t]].z = V[p].to[t];
            }
        }
    }

    vector<ULL> dp(V.size());
    dp[0] = 1;

    rep(n, N) {
        vector<ULL> buf(V.size());
        rep(i, V.size()) rep(t, 10) {
            int p = i;
            while (V[p].to[t] == -1) p = V[p].z;
            buf[V[p].to[t]] += dp[i];
        }
        rep(i, V.size()) {
            dp[i] = buf[i] % M;
            if (V[i].enable) dp[i] = 0;
        }
    }

    ULL ans = 0;
    for (ULL a : dp) ans += a;
    ans += (M - 1);
    ans %= M;
    cout << ans << endl;

    return 0;
}