#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double EPS = 1e-9;
typedef pair<int, int> P;
typedef unsigned int ui;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef vector<vector<ll>> mat;
typedef vector<ll> vec;
mat A = { {(ll)1,(ll)1},{(ll)1,(ll) 0 } };
mat mtmul(mat &A, mat &B) {
	mat C(A.size(), vec(B[0].size()));
	rep(i, (int)A.size()) {
		rep(k, (int)B.size()) {
			rep(j, (int)B[0].size()) {
				C[i][j] = (C[i][j] + (A[i][k] * B[k][j]) % MOD) % MOD;
			}
		}
	}
	return C;
}
mat mtpow(mat A, ll n) {
	mat B(A.size(), vec(A.size()));
	rep(i, (int)A.size()) {
		B[i][i] = 1;
	}
	while (n > 0) {
		if (n&(ll)1)B = mtmul(B, A);
		A = mtmul(A, A);
		n >>= 1;
	}
	return B;
}
int main() {
	ll k; cin >> k;
	ll t = (ll)sqrt(k);
	if (t*(t + (ll)1) < k){
		t++;
    }
	k -= t * (t - 1);
	ll x, y;
	if (k <= t) {
		ll sum = (ll)2 * t;
		ll l = (sum + (ll)1) / (ll)2;
		ll len = (l + (ll)1) / 2;
		if (k <= len) {
		    x = (ll)-1 + (ll)2 * k;
		    y = sum - x;
		}
		else {
			k -= len;
			x = (ll)2 * (l / (ll)2) - ((ll)2 * (k - (ll)1));
			y = sum - x;
		}
		mat X = A; mat Y = A;
		X = mtpow(X, x + (ll)1);
		Y = mtpow(Y, y + (ll)1);
		cout << X[1][0] * Y[1][0] % MOD << endl;
	}
	else {
		ll sum = (ll)2 * t + (ll)1;
		k -= t;
		ll l = (sum) / (ll)2;
		ll len = (l + (ll)1) / (ll)2;
		if (k <= len) {
			x = (ll)-1 + (ll)2 * k;
			y = sum - x;
		}
		else {
			k -= len;
			x = (ll)2 * (l / (ll)2) - ((ll)2 * (k - (ll)1));
			y = sum - x;
		}
		mat X = A; mat Y = A;
		X = mtpow(X, x + (ll)1);
		Y = mtpow(Y, y + (ll)1);
		cout << X[1][0] * Y[1][0] % MOD << endl;
	}
	return 0;
}
