from collections import deque class AhoCorasick: def __init__(self, words=None): if words is None: self.words = [] else: self.words = words def register(self, word): self.words.append(word) def build(self): self.children = [{}] self.match = [[]] for i, word in enumerate(self.words): self._register(i, word) self.failure = [0] * len(self.children) self._create_failure() def _register(self, i, word): k = 0 for s in word: if s in self.children[k]: k = self.children[k][s] else: le = len(self.children) self.children[k][s] = le self.children.append({}) self.match.append([]) k = le self.match[k].append(i) def _create_failure(self): queue = deque(self.children[0].values()) while queue: k = queue.popleft() b = self.failure[k] for s, j in self.children[k].items(): self.failure[j] = self._next(b, s) self.match[j] += self.match[self.failure[j]] queue.append(j) def _next(self, k, s): while 1: if s in self.children[k]: return self.children[k][s] elif k == 0: return 0 k = self.failure[k] def search(self, text): k = 0 le = len(text) matched = [[] for _ in range(le)] for i, s in enumerate(text): k = self._next(k, s) for m in self.match[k]: matched[i - len(self.words[m]) + 1].append(m) return matched MOD = 10**9 + 7 n, l, r = map(int, input().split()) aho = AhoCorasick() a = 1 b = 1 while b <= r: if l <= b <= r: aho.register(str(b)) a, b = b, a + b aho.build() m = len(aho.children) dp = [0] * m dp[0] = 1 for _ in range(n): ndp = [0] * m for k, v in enumerate(dp): for i in range(10): nex = aho._next(k, str(i)) if aho.match[nex]: continue ndp[nex] += v dp = [d % MOD for d in ndp] print((sum(dp) - 1) % MOD)