#include using namespace std; const long long MOD = 1000000007; int main(){ int N; cin >> N; long long L, R; cin >> L >> R; vector F(2, 1); while (1){ long long next = F[F.size() - 2] + F[F.size() - 1]; if (next <= R){ F.push_back(next); } else { break; } } set ng; for (long long x : F){ if (L <= x && x <= R){ ng.insert(to_string(x)); } } vector prf; for (string S : ng){ int len = S.size(); for (int j = 0; j <= len; j++){ prf.push_back(S.substr(0, j)); } } sort(prf.begin(), prf.end()); prf.erase(unique(prf.begin(), prf.end()), prf.end()); int V = prf.size(); map id; for (int i = 0; i < V; i++){ id[prf[i]] = i; } vector> next(V, vector(10, -1)); for (int i = 0; i < V; i++){ for (int j = 0; j <= 9; j++){ string S = prf[i]; S += '0' + j; int len = S.size(); bool ok = true; for (int k = 0; k <= len; k++){ string T = S.substr(k); if (ng.count(T)){ ok = false; } } if (ok){ for (int k = 0; k <= len; k++){ string T = S.substr(k); if (id.count(T)){ next[i][j] = id[T]; break; } } } } } vector> dp(N + 1, vector(V, 0)); dp[0][0] = 1; for (int i = 0; i < N; i++){ for (int j = 0; j < V; j++){ for (int k = 0; k <= 9; k++){ if (next[j][k] != -1){ if (!(i == 0 && k == 0)){ dp[i + 1][next[j][k]] += dp[i][j]; dp[i + 1][next[j][k]] %= MOD; } } } } } long long ans = 0; for (int i = 1; i <= N; i++){ for (int j = 0; j < V; j++){ ans += dp[i][j]; ans %= MOD; } } cout << ans << endl; }