#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long int lli;
const lli mod = 1e9 +7;
const double EPS = 1e-10;

typedef vector<lli> vec;
typedef vector<vec> matrix;

matrix mul(const matrix &a, const matrix &b){
	int h = a.size();
	int w = b[0].size();
	int r = b.size();
	matrix c(h, vec(w, 0));
	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			for(int k=0; k<r; k++){
				c[i][j] += a[i][k] *b[k][j];
				c[i][j] %= mod;
			}
		}
	}
	return c;
}

lli fibonacci(lli n){
	matrix a(2, vec(2, 1)), ret(2, vec(2, 0));
	a[1][1] = 0;
	ret[0][0] = ret[1][1] = 1;
	for(int i=63; i>=0; i--){
		ret = mul(ret, ret);
		if((1LL<<i & n) != 0){
			ret = mul(ret, a);
		}
	}
	return ret[0][1];
}

int main(){
	lli k;
	cin >> k;
	lli row, col; // 0-idx
	lli q = sqrt(k) + EPS;
	if(q*(q+1) < k) q++;
	if(q*q >= k){
		row = (q-1)*2;
		col = k -q*(q-1) -1;
	}else{
		row = (q-1)*2 +1;
		col = k -q*q -1;
	}
	
	lli fhalf = row/4 +1;
	lli ans;
	if(col < fhalf){
		ans = fibonacci((col+1)*2) * fibonacci(row+2 -col*2);
	}else{
		lli w = row/2 +1;
		ans = fibonacci((w-col)*2 +1) * fibonacci(row+3 -(w-col)*2);
	}
	ans %= mod;
	cout << ans << endl;
	return 0;
}
