There are less than 60 years left till the 900-th birthday anniversary of a famous Italian mathematician Leonardo Fibonacci. Of course, such important anniversary needs much preparations.

Dima is sure that it'll be great to learn to solve the following problem by the Big Day: You're given a set *A*, consisting of numbers *l*, *l* + 1, *l* + 2, ..., *r*; let's consider all its *k*-element subsets; for each such subset let's find the largest common divisor of Fibonacci numbers with indexes, determined by the subset elements. Among all found common divisors, Dima is interested in the largest one.

Dima asked to remind you that Fibonacci numbers are elements of a numeric sequence, where *F*<sub class="lower-index">1</sub> = 1, *F*<sub class="lower-index">2</sub> = 1, *F*<sub class="lower-index">*n*</sub> = *F*<sub class="lower-index">*n* - 1</sub> + *F*<sub class="lower-index">*n* - 2</sub> for *n* ≥ 3.

Dima has more than half a century ahead to solve the given task, but you only have two hours. Count the residue from dividing the sought largest common divisor by *m*.
The first line contains four space-separated integers *m*, *l*, *r* and *k* (1 ≤ *m* ≤ 10<sup class="upper-index">9</sup>; 1 ≤ *l* &lt; *r* ≤ 10<sup class="upper-index">12</sup>; 2 ≤ *k* ≤ *r* - *l* + 1).

Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier.
import bisect
import copy
import decimal
import fractions
import functools
import heapq
import itertools
import math
import random
import sys
from collections import Counter,deque,defaultdict
from functools import lru_cache,reduce
from heapq import heappush,heappop,heapify,heappushpop,_heappop_max,_heapify_max
def _heappush_max(heap,item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)
def _heappushpop_max(heap, item):
    if heap and item < heap[0]:
        item, heap[0] = heap[0], item
        heapq._siftup_max(heap, 0)
    return item
from math import gcd as GCD
read=sys.stdin.read
readline=sys.stdin.readline
readlines=sys.stdin.readlines

def Bostan_Mori(poly_nume,poly_deno,N,mod=0,fft=False,ntt=False):
    if ntt:
        convolve=NTT
    elif fft:
        convolve=FFT
    else:
        def convolve(poly_nume,poly_deno):
            conv=[0]*(len(poly_nume)+len(poly_deno)-1)
            for i in range(len(poly_nume)):
                for j in range(len(poly_deno)):
                    conv[i+j]+=poly_nume[i]*poly_deno[j]
            if mod:
                for i in range(len(conv)):
                    conv[i]%=mod
            return conv
    while N:
        poly_deno_=[-x if i%2 else x for i,x in enumerate(poly_deno)]
        if N%2:
            poly_nume=convolve(poly_nume,poly_deno_)[1::2]
        else:
            poly_nume=convolve(poly_nume,poly_deno_)[::2]
        poly_deno=convolve(poly_deno,poly_deno_)[::2]
        if fft and mod:
            for i in range(len(poly_nume)):
                poly_nume[i]%=mod
            for i in range(len(poly_deno)):
                poly_deno[i]%=mod
        N//=2
    return poly_nume[0]

M,L,R,K=map(int,readline().split())
bound=[]
for i in range(1,R):
    if i**2<=R:
        bound.append(i)
        bound.append(R//i)
    else:
        break
for i in range(1,R):
    if i**2<=L:
        bound.append(L//i)
    else:
        break
d=0
for i in bound:
    if R//i-(L-1)//i>=K:
        d=max(d,i)
ans=Bostan_Mori([0,1],[1,-1,-1],d,mod=M)
print(ans)