#include using namespace std; using ll = long long; int main() { int n; ll l, r; cin >> n >> l >> r; ll a = 1, b = 1; vector s; while (b <= r) { if (l <= b) s.push_back(to_string(b)); ll c = a + b; a = b; b = c; } vector prefix; for (auto& si : s) { for (size_t i = 0; i <= si.size(); ++i) { prefix.push_back(si.substr(0, i)); } } sort(prefix.begin(), prefix.end()); prefix.erase(unique(prefix.begin(), prefix.end()), prefix.end()); int m = prefix.size(); vector ng(m); vector nxt(m, vector(10, 0)); for (int i = 0; i < m; ++i) { for (auto& si : s) { if (si.size() <= prefix[i].size() && si == prefix[i].substr(prefix[i].size() - si.size(), si.size())) { ng[i] = true; break; } } for (int j = 0; j < 10; ++j) { char c = '0' + j; string t = prefix[i] + c; int k; while (true) { k = distance(prefix.begin(), lower_bound(prefix.begin(), prefix.end(), t)); if (k < m && prefix[k] == t) break; t = t.substr(1); } nxt[i][j] = k; } } const int mod = 1000000007; vector dp(n+1, vector(m, 0LL)); dp[0][0] = 1; for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { if (ng[j]) continue; for (int k = 0; k < 10; ++k) { int nj = nxt[j][k]; if (ng[nj]) continue; if (i == 0 && k == 0) continue; dp[i+1][nj] += dp[i][j]; dp[i+1][nj] %= mod; } } } int ans = 0; for (int i = 1; i <= n; ++i) { for (int j = 0; j < m; ++j) { ans += dp[i][j]; ans %= mod; } } cout << ans << '\n'; }