#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-9;

ll g(ll x) {
	return x * (x + 1) / 2;
}

ll f(ll x) {
	return g((x + 1) / 2) + g(x / 2);
}

vector< vector<ll> > matmul(vector< vector<ll> >& A, vector< vector<ll> >& B) {
	int n = A.size();
	vector< vector<ll> > C(n, vector<ll>(n));
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			for (int k = 0; k < n; k++)
				C[i][j] = (C[i][j] + A[i][k] * B[k][j]) % MOD;
	return C;
}

vector< vector<ll> > matpow(vector< vector<ll> > A, ll x) {
	int n = A.size();
	vector< vector<ll> > B(n, vector<ll>(n));
	for (int i = 0; i < n; i++) B[i][i] = 1;
	while (x > 0) {
		if (x % 2) B = matmul(B, A);
		x /= 2;
		A = matmul(A, A);
	}
	return B;
}

int main() {
	ll K; cin >> K; K--;
	ll lb = 0, ub = 2000000000;
	while (ub - lb > 1) {
		ll mid = (lb + ub) / 2;
		if (f(mid) <= K) lb = mid;
		else ub = mid;
	}
	K -= f(lb);
	ll n = lb / 2 + 1, x, y;
	if (K < (n + 1) / 2) {
		x = K * 2;
		y = lb - x;
	}
	else {
		K -= (n + 1) / 2;
		x = (n / 2 - K) * 2 - 1;
		y = lb - x;
	}
	vector<vector<ll> > A(2, vector<ll>(2));
	A[0][1] = A[1][0] = A[1][1] = 1;
	cout << (matpow(A, x + 1)[1][1] * matpow(A, y + 1)[1][1]) % MOD << endl;
}