#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD=1e9+7;
void matmul(ll x[2][2], ll y[2][2], ll m, ll ans[2][2]){
	for(int i=0; i<2; i++){
		for(int j=0; j<2; j++){
			ans[i][j]=0;
			for(int k=0; k<2; k++){
				ans[i][j]+=(x[i][k]*y[k][j]);
				ans[i][j]%=m;
			}
		}
	}
}
void matpow(ll x[2][2], ll k, ll m, ll ans[2][2]){
	ans[0][0]=1, ans[1][1]=1, ans[1][0]=0, ans[0][1]=0;
	ll xp[2][2];
	for(int i=0; i<2; i++) for(int j=0; j<2; j++) xp[i][j]=x[i][j];
	while(k){
		if(k&1){
			ll ans1[2][2];
			matmul(ans, xp, m, ans1);
			for(int i=0; i<2; i++) for(int j=0; j<2; j++) ans[i][j]=ans1[i][j];
		}
		ll ans1[2][2];
		matmul(xp, xp, m, ans1);
		for(int i=0; i<2; i++) for(int j=0; j<2; j++) xp[i][j]=ans1[i][j];
		k>>=1;
	}
}
ll fib(ll a){
	if(a==1) return 1;
	ll x[2][2], ans[2][2];
	x[0][0]=x[0][1]=x[1][0]=1, x[1][1]=0;
	matpow(x, a-1, MOD, ans);
	return (ans[1][0]*2+ans[1][1])%MOD;
}
int main()
{
	ll k;
	cin>>k;
	if(k==1){
		cout<<1<<endl;
		return 0;
	}
	ll n1=2, n2=2e9+1;
	while(n1!=n2){
		ll n=(n1+n2+1)/2;
		if(n&1){
			if((n/2+1)*(n/2)<k) n1=n;
			else n2=n-1;
		}else{
			if((n/2-1)*(n/2)+n/2<k) n1=n;
			else n2=n-1;
		}
	}
	ll n=n1, m, a, b;
	if(n&1) m=k-((n/2+1)*(n/2));
	else m=k-((n/2-1)*(n/2)+n/2);
	if(m<=((n+1)/2+1)/2) a=2*m-1, b=n+1-a;
	else{
		if((n+1)/2%2==0) a=(n+1)/2-2*(m-((n+1)/2+1)/2-1), b=n+1-a;
		else a=(n+1)/2-1-2*(m-((n+1)/2+1)/2-1), b=n+1-a;
	}
	cout<<fib(a)*fib(b)%MOD<<endl;
	return 0;
}
