// Program written by Liu Zhaozhou ~~~
#include <bits/stdc++.h>
#define lowbit(x) (x & -x)
using namespace std;
inline char gc(void) {
static char buf[100000], *p1 = buf, *p2 = buf;
return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2) ? EOF : *p1++;
}
#define gc() getchar()
template <class T> inline void read(T &x) {
T f = 1; x = 0; static char c = gc();
for (; !isdigit(c); c = gc()) if (c == '-') f = -f;
for (; isdigit(c); c = gc()) x = x * 10 + (c & 15);
x *= f;
}
inline void readstr(char *s) {
do *s = gc(); while ((*s == ' ') || (*s == '\n') || (*s == '\r'));
do *(++s) = gc(); while ((~*s) && (*s != ' ') && (*s != '\n') && (*s != '\r'));
*s = 0; return;
}
inline void readch(char&x) { while (isspace(x = gc())); }
char pf[100000], *o1 = pf, *o2 = pf + 100000;
#define ot(x) (o1 == o2 ? fwrite(pf, 1, 100000, stdout), *(o1 = pf) ++= x : *o1 ++= x)
template <class T>
inline void println(T x, char c = '\n') {
if (x < 0) ot(45), x = -x;
static char s[15], *b; b = s;
if (!x) *b ++= 48;
for (; x; * b ++= x % 10 + 48, x /= 10);
for (; b-- != s; ot(*b)); ot(c);
}
template <class T> inline void write(T x) {
if (x < 0) x = -x, putchar('-');
if (x > 9) write(x / 10);
putchar(x % 10 + 48);
}
template <class T> inline void writeln(T x, char c = '\n') { write(x); putchar(c); }
template <class T> inline void chkmax(T &x, const T y) { x > y ? x = x : x = y; }
template <class T> inline void chkmin(T &x, const T y) { x < y ? x = x : x = y; }
#define Ms(arr, opt) memset(arr, opt, sizeof(arr))
#define Mp(x, y) make_pair(x, y)
typedef long long ll;
typedef pair <int, int> pii;
#define int long long
#define mod 2148473647
inline int qpow(int a, int b) {
int ret = 1;
for (; b; b >>= 1, a = 1ull * a * a % mod)
if (b & 1) ret = 1ull * ret * a % mod;
return ret;
}
signed main(void) {
int X; read(X);
int ans = (X * (X + 1) / 2) % mod;
ans = ans * qpow(2 * X - 1, mod - 2) % mod;
writeln(ans);
//fwrite(pf, 1, o1 - pf, stdout);
return 0;
}
/**/