//HEADER FILES AND NAMESPACES
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

// DEFINE STATEMENTS
const long long inf = 1e18;
#define M 1000000007
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define repd(i,a,n) for(ll i=a; i>=n; i--)
#define repit(x) for(auto it=x.begin();it!=x.end();it++)
#define repitr(x) for(auto it=x.rbegin();it!=x.rend();it++)
#define size(x) (int)(x.size())
#define pb push_back
#define pob pop_back
#define mp make_pair
#define f first
#define s second
#define fix(f,n) std::fixed<<std::setprecision(n)<<f
#define all(x) x.begin(), x.end()
#define M_PI 3.14159265358979323846
#define epsilon (double)(0.000000001)
#define popcount __builtin_popcountll
#define fileio(x,y) freopen(x, "r", stdin); freopen(y, "w", stdout);
#define lc(i) (i<<1)
#define rc(i) (lc(i)|1)
#define mid(x,y) (y-x)/2+x
#define ll1(p) ll p;cin>>p
#define ll2(p,q) ll p,q;cin>>p>>q
#define ll3(p,q,r) ll p,q,r;cin>>p>>q>>r
#define ll4(p,q,r,s) ll p,q,r,s;cin>>p>>q>>r>>s
#define ch1(p) char p;cin>>p
#define ch2(p,q) char p,q;cin>>p>>q
#define str1(p) string p;cin>>p
#define str2(p,q) string p,q;cin>>p>>q

typedef long long ll;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pair<long long, long long>> vpll;
typedef vector<int> vi;

// DEBUG FUNCTIONS
#ifdef LOCALFLAG
template<typename T>
void __p(T a) { cout<<a; }
template<typename T, typename F>
void __p(pair<T, F> a) { cout<<"{"; __p(a.first); cout<<","; __p(a.second); cout<<"}"; }
template<typename T>
void __p(std::vector<T> a) { cout<<"{"; for(auto it=a.begin(); it<a.end(); it++) __p(*it),cout<<",}"[it+1==a.end()]; }
template<typename T>
void __p(std::set<T> a) { cout<<"{"; for(auto it=a.begin(); it!=a.end();){ __p(*it); cout<<",}"[++it==a.end()]; } }
template<typename T>
void __p(std::multiset<T> a) { cout<<"{"; for(auto it=a.begin(); it!=a.end();) { __p(*it); cout<<",}"[++it==a.end()]; } }
template<typename T, typename F>
void __p(std::map<T,F> a) { cout<<"{\n"; for(auto it=a.begin(); it!=a.end();++it) { __p(it->first); cout << ": "; __p(it->second); cout<<"\n"; } cout << "}\n"; }
template<typename T, typename ...Arg>
void __p(T a1, Arg ...a) { __p(a1); __p(a...); }
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) { cout<<name<<" : "; __p(arg1); cout<<endl; }
template<typename Arg1, typename ... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) { int bracket=0,i=0; for(;; i++) if(names[i]==','&&bracket==0) break; else if(names[i]=='(') bracket++; else if(names[i]==')') bracket--; const char *comma=names+i; cout.write(names,comma-names)<<" : "; __p(arg1); cout<<" | "; __f(comma+1,args...); }
#define trace(...) cout<<"Line:"<<__LINE__<<" ", __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...)
#define error(...)
#endif
// DEBUG FUNCTIONS END

// CUSTOM HASH TO SPEED UP UNORDERED MAP AND TO AVOID FORCED CLASHES
// struct custom_hash { static uint64_t splitmix64(uint64_t x) { x += 0x9e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb; return x ^ (x >> 31); } size_t operator()(uint64_t x) const { static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); return splitmix64(x + FIXED_RANDOM); } };
void myerase(ordered_multiset<long long> &t, int v){
    int rank = t.order_of_key(v);
    ordered_multiset<long long>::iterator it = t.find_by_order(rank);
    t.erase(it);
}
void myerase(ordered_set<long long> &t, int v){
    int rank = t.order_of_key(v);
    ordered_set<long long>::iterator it = t.find_by_order(rank);
    t.erase(it);
}
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());  // FOR RANDOM NUMBER GENERATION
ll mod_exp(ll a, ll b, ll c) { ll res=1; a=a%c; while(b>0) { if(b%2==1) res=(res*a)%c; b/=2; a=(a*a)%c; } return res; }
ll mymod(ll a,ll b) { return ((a%b)+b)%b; }
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a; }
ll gcdExtended(ll,ll,ll *,ll *);
ll modInverse(ll a, ll m) {
        ll x, y;
        ll g = gcdExtended(a, m, &x, &y);
        g++;   //this line was added just to remove compiler warning
        ll res = (x%m + m) % m;
        return res;
}
ll gcdExtended(ll a, ll b, ll *x, ll *y) {
        if (a == 0) { *x = 0, *y = 1; return b; }
        ll x1, y1;
        ll gcd = gcdExtended(b%a, a, &x1, &y1);
        *x = y1 - (b/a) * x1;
        *y = x1;
        return gcd;
}

// MOD careful
void solve() {
    ll1(n);
    if(n==1) cout<<"3";
    else {
        n-=2;
        ll r=n/3;
        ll s=r*4+5+(n%3==0?0:(n%3+1));
        cout<<s;
    }
}
// MOD careful

int main()
{
    #ifdef LOCALFLAG
        freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    #endif
    //fileio(".in",".out")
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t=1;
    // cin>>t;
    while(t>0) {
        solve();
        t--;
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long

void solve(){
    ll n;
    cin >> n;
    if(n==1) cout << 3 << endl;
    else cout << 4 + (4*n-3)/3 << endl;
}

int main(){
    solve();
}

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/STACK: 128000000")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define endl "\n"
#define mod (ll)(1e9+7)
#define inf 1e18
#define ll long long
#define ull unsigned long long
#define ld long double
#define set_bit __builtin_popcountll // check no of 1 set bit (x)
#define edge(x,y) adj[x].push_back(y);adj[y].push_back(x);
#define dedge(x,y) adj[x].push_back(y);
#define pq_dec(i) priority_queue<i,vector<i>, greater<i>>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define oset(x,y) tree<x, null_type, y<x>, rb_tree_tag, tree_order_statistics_node_update >

// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update > oset;
// oset -> less, greater , multiset -> less_equal , greater_equal
// m.order_of_key (k) : Number of items strictly smaller than k .
//*m.find_by_order(k) : K-th element in a set (counting from zero).

#ifdef LOCAL
#define debug(x) cerr << #x <<" "; _print(x); cerr << endl;
#else
#define debug(x)
#endif

void _print(ll t) {cerr << t;}
void _print(int t) {cerr << t;}
void _print(string t) {cerr << t;}
void _print(char t) {cerr << t;}
void _print(double t) {cerr << t;}
void _print(ull t) {cerr << t;}
void _print(long t) {cerr << t;}

template <class T, class V> void _print(pair <T, V> p);
template <class T> void _print(vector <T> v);
template <class T> void _print(set <T> v);
template <class T, class V> void _print(map <T, V> v);
template <class T> void _print(unordered_set <T> v);
template <class T , class V> void _print(unordered_map <T, V> v);
template <class T> void _print(multiset <T> v);
template <class T> void _print(priority_queue <T>v);
template <class T> void _print(priority_queue <T, vector<T>, greater<T>>);

template <class T, class V> void _print(pair <T, V> p) {cerr << "{"; _print(p.first); cerr << ","; _print(p.second); cerr << "}";}
template <class T> void _print(vector <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(set <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(multiset <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(unordered_set <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T, class V> void _print(map <T, V> v) {cerr << "[ "; for (auto i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T, class V> void _print(unordered_map <T, V> v) {cerr << "[ "; for (auto i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(priority_queue <T> c) {cerr << "[ "; priority_queue <T> v = c; while (v.size()) {cerr << v.top() << " "; v.pop();} cerr << "]";}
template <class T> void _print(priority_queue <T, vector<T>, greater<T>> c) {cerr << "[ "; priority_queue <T, vector<T> , greater<T>> v = c; while (v.size()) {cerr << v.top() << " "; v.pop();} cerr << "]";}

/*-----------------------------------------------------------------------------------------------------------------------------------*/
ll max(ll a, ll b) {if (a > b)return a; return b;}
ll min(ll a, ll b) {if (a < b)return a; return b;}
ll gcd(ll a, ll b) {if (b > a) {return gcd(b, a);} if (b == 0) {return a;} return gcd(b, a % b);}
ll expo(ll a, ll b, ll m) {ll res = 1; while (b > 0) {if (b & 1)res = (res * a) % m; a = (a * a) % m; b = b >> 1;} return res;}
vector<ll> sieve(int n) {int*arr = new int[n + 1](); vector<ll> vect; for (int i = 2; i <= n; i++)if (arr[i] == 0) {vect.push_back(i); for (int j = 2 * i; j <= n; j += i)arr[j] = 1;} return vect;}
void google(ll t) {cout << "Case #" << t << ": ";}
void yes(int x = 0) {if (!x)cout << "Yes" << endl; else cout << "YES" << endl;}
void no(int x = 0)  {if (x)cout << "NO" << endl; else cout << "No" << endl; }
/*-----------------------------------------------------------------------------------------------------------------------------------*/
void predefined()
{
  ios_base::sync_with_stdio(false); cin.tie(NULL); // must be disabled in interactive question
#ifdef LOCAL
  freopen("error.txt", "w", stderr);
  freopen("Input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
}

void solve()
{

  ll n; cin >> n;
  ll ans = 0;

  if (n == 1) {
    cout << 3 << endl;
    return;
  }

  n--;
  if (n % 3 == 0)
    cout << 4 + 4 * n / 3  << endl;
  else if (n % 3 == 1)
    cout << 4 + n / 3 * 4  + 1 << endl;
  else
    cout << 4 + n / 3 * 4  + 3 << endl;

}

int main()
{
  cout << setprecision(1) << fixed;
  predefined();
  ll t = 1;
  // cin >> t;
  for (int i = 0; i < t; i++)
  {
    // google(i + 1);
    solve();
  }
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int INF=0x3f3f3f3f;
const int mod=1e9+7;
const int N=1e5+10,M=2e5+5;

int n,m,k,p;

bool check(ll x) {
    ll cnt=x/2+(x&1)+x/4-1-(x>=4);
    return cnt>=n;
}

void solve() {
    cin>>n;
    ll l=3,r=1e12;
    while(l<r) {
        int mid=(l+r)>>1;
        if(check(mid)) r=mid;
        else l=mid+1;
    }
    printf("%lld\n",l);
}

signed main() {
    //freopen("data.in","r",stdin);
    //ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int T=1; //cin>>T;
	while(T--) {
        //cout<<"Case#"<<T<<":\n";
        solve();
	}
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main(){
    int N; cin >> N;
    if (N == 1) cout << 3 << endl;
    else if (N == 2) cout << 5 << endl;
    else cout << N + N/3 + 3 << endl;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

void solve() {
	int n; cin >> n;
	ll l = 0, r = 1e12, ans = -1;
	auto chk = [&](ll x) {
		ll val = x - 1 - (x + 2 >> 2) - (x >= 4);
		return val;
	};
	while (l < r) {
		ll mid = l + r >> 1;
		if(chk(mid) >= n) ans = mid, r = mid;
		else l = mid + 1;
	}
	cout << ans << endl;
}

int main()
{
	ios::sync_with_stdio(false); cin.tie(nullptr);
	solve();
	return 0;
}

// Problem: G. Garage
// Contest: Codeforces - COMPFEST 14 - Preliminary Online Mirror (Unrated, ICPC Rules, Teams Preferred)
// URL: https://codeforces.com/problemset/problem/1725/G
// Memory Limit: 128 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)

#include <cstdio>
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cctype>
//#include <unordered_set>
using namespace std;
#define pb push_back
#define x first
#define y second
#define reps(i, a, b) for (int i = a; i <= (b); i ++ )
#define rep(i, a) for (int i = 0; i < a; i ++ )
#define repds(i, a, b) for (int i = (a); i >= 0; i -- )
#define repd(i, a) for (int i = (a); i >= 0; i -- )
#define trav(a, x) for (auto &a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define one(x) memset(x, -1, sizeof x)
#define zero(x) memset(x, 0, sizeof x)
#define lb(c, x) distance((c).begin(), lower_bound(all(c),(x)))
#define ub(c, x) distance((c).begin(), upper_bound(all(c),(x)))
#define debug(x) cerr << #x <<" : " << x << '\n'
#define endl '\n'
#define yesorno(x) cout << (x ? "YES" : "NO") << endl;
#define IO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define inf 0x3f3f3f3f
typedef long long LL;
typedef pair<int,int> PII;
const int N = 2e5 + 10;
int T;

void solve()
{
	int n;
	cin >> n;
	if (n == 1) cout << 3 << endl;
	else if (n == 2) cout << 5 << endl;
	else cout << (n - 3) / 3 + n + 4 << endl;
}
int main ()
{
    IO;
    T = 1;
    while (T -- ) solve();
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int maxn=1e6+5;
void solve(){
	int n;
	cin>>n;
	int l=3,r=2e9,mid,ans;
	while(l<r){
		mid=(l+r)/2;
		int x=(mid-3)/2+1;
		int y=(max(0ll,mid-8))/4+1;
		if(mid<8)y=0;
		if(x+y>=n){
			r=mid;
		}
		else{
			l=mid+1;
		}
	}
	if(r%4==0){
		cout<<r<<endl;
	}
	else cout<<(r-((r-1)%2))<<endl;
}
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);cout.tie(nullptr);
	solve();
	return 0;
}
// b2-a2==(b-a)*(b+a)
// int x=(b+a);
// int y=(b-a);
//  b=(x+y)/2;
//  a=(x-y)/2;
// //x y 同奇偶 且x*y==c方
// if(c方%2==1)true  //枚举c方
// else if(c方%2==0&&c方/2%2==0)true
// else false

 ///   BISMILLAHIR RAHMANIR RAHEEM
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef  long long int ll;
typedef   unsigned long long int ull;
#define _ios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(i) i.begin(),i.end()
#define pb push_back
#define ft first
#define sc second
#define Yes cout<<"YES"<<endl
#define No cout<<"NO"<<endl
#define maxx 500
#define o_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
#define o_mset tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>
const ll MOD=1e9+7;
//const ll q=1e9+1;
//const ll N=1e10;
vector<ll> v[300002];
ll vis[300002];
ll a[30002];
void solve()
{
    ll n;
    cin>>n;
    ll i=3,j=1000000000000000000;
    ll res=0;
    while(i<=j)
    {
        ll mid=(i+j)/2;
        ll ans;
        if(mid&1)
        {
           ans=mid/2;
           ans+=(mid)/4;
           if(mid/4>0)
           ans--;
        }
        else
        {
            ans=mid/2-1;
            ans+=(mid/4);
            //if(ans>0)
           if(mid/4>0)
            ans--;
        }
        if(ans>=n)
        {
            if(mid&1)
                res=mid;
            else if(mid%4==0 and mid>4)
                res=mid;
            j=mid-1;
        }
        else
        {
            i=mid+1;
        }
    }
    cout<<res<<endl;
}
int main()
{
    _ios;
    //sieve();
    int t=1;
    //cin>>t;
    for(int s=1;s<=t;s++)
    {
       solve();
    }

    return 0;
}

#include <cstdio>
int n;
int main() {
	scanf("%d", &n);
	if (n == 1) puts("3");
	else if (n == 2) puts("5");
	else if (n == 3) puts("7");
	else {
		n -= 4;
		int m = n / 3;
		long long s = (m + 2) * 4;
		m = n % 3;
		if (m >= 1) s ++;
		if (m >= 2) s += 2;
		printf("%lld\n", s);
	}
	return 0;
}

#include <iostream>
using namespace std;
long long n;
int main() {
  cin>>n;
  if(n==1) cout<<3;
  else
   cout<<(4*n+9)/3;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n;
    cin >> n;
    long long x=(n-1)%3;
    if(n==1) cout << 3 << endl;
    else if(x!=0) cout << 4+4*((n-1)/3)+2*x-1 << endl;
					else cout << 4+4*((n-1)/3) << endl;

}

//ॐ नमः शिवाय
#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main()
{
    ll n;
    cin >> n;
    // n++;
    ll ans = 0;
    if(n==1){
        cout << 3 << endl;
    }
    else if (n % 3 == 0)
    {
        int n1 = n / 3 + 1;
        cout << 4 * n1 - 1 << endl;
    }
    else if (n % 3 == 1)
    {
        int n1 = n / 3 + 1;
        cout << 4 * n1 << endl;
    }
    else
    {
        int n1 = n / 3 + 1;
        cout << 4 * n1 + 1 << endl;
    }
    return 0;
}

/*

  1           2 --> 3
  1 2         3 --> 5, 8

  1 2 3       4 --> 7, 12, 15

  1 2 3 4     5 --> 9, 16, 21, 24

  1 2 3 4 5   6 --> 11, 22, 27, 32, 35

  ->
N/2 - 1 +
 */

#ifdef LOCAL
#  define _GLIBCXX_DEBUG
#else
#  define cerr __get_ce
#endif
#include <bits/stdc++.h>
using namespace std;
int const INF = (int)1e9 + 1e3;
long long const INFL = (long long)1e18 + 1e6;

#ifdef LOCAL
    mt19937 tw(9450189);
#else
    mt19937 tw(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif
uniform_int_distribution<long long> ll_distr;
long long rnd(long long a, long long b) { return ll_distr(tw) % (b - a + 1) + a; }

struct test{
    void solve(){

/* ___________________________________________________*/

    //start here
    // vector<int> v;
    // for(int i = 2; i<25; i++){
    //   for(int j = 1; j<i; j++){
    //     v.emplace_back(i*i - j*j);
    //   }
    // }

    // sort(v.begin(), v.end());
    // for(auto e: v){
    //   cout<<e<<' ';
    // }

    //unique(v.begin(), v.begin())

    int N;
    cin>>N;

    long long low = 3, high = 2e9+5;

    if(N==1){
      cout<<3;
      return;
    }
    if(N==2){
      cout<<5;
      return;
    }
    if(N==3){
      cout<<7;
      return;
    }
    if(N==4){
      cout<<8;
      return;
    }

    int chk  = 0;

    while(true){
      long long mid = low + (high - low)/2;
      if(mid%2==0 && mid%4!=0){
        mid++;
      }
//3, 5, 7, 8, 9, 11, 12, 13, 15, 16, 17...

//-1 -2 3 -4 5 -6 7
      //cout<<mid<<'\n';

      long long cnt = (mid-2)/4+3;
      cnt = mid - cnt;
      if(cnt<N){
        low = mid;
      }
      if(cnt>N){
        high = mid;
      }
      if(cnt == N){
        cout<<mid;
        return;
      }

      chk++;

      if(chk==50){
        break;
      }

    }

/*_____________________________________________________*/

    }
};

int main() {

#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE
#ifdef LOCAL
    auto start_time = clock();
    cerr << setprecision(3) << fixed;
#endif
    cout << setprecision(15) << fixed;
    ios::sync_with_stdio(false);

    cin.tie(nullptr);

    int test_count = 1;
    //cin >> test_count;
    test T;
    for (int test = 1; test <= test_count; ++test) {
        T. solve();
    }

#ifdef LOCAL
    auto end_time = clock();
    cerr << "Execution time: " << (end_time - start_time) * (int)1e3 / CLOCKS_PER_SEC << " ms\n";
#endif
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5+10;
int n;
ll a[N],b[N];
inline int count(int mid){
    ll res=0;
    for(int i=2;mid>=a[i];i++)
    res+=(mid-a[i])/b[i]+1;
    return res>=n;
}
int main(){
    cin>>n;
    if(n==1)cout<<3;
    else cout<<4+(4ll*n-3)/3;
}

#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<algorithm>
using namespace std;
int t,n,m;
const int N = 1e5+10;
typedef long long ll;

bool check(ll x)
{
	ll cnt=0;
	cnt+=(x+1)/2-1;
	if(x>=4)
	cnt+=x/4-1;
	return cnt>=n;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	cin>>n;
	ll l=0,r=1e18;
	while(l<r)
	{
		ll mid=(l+r)/2;
		if(check(mid))r=mid;
		else l=mid+1;
	}
	cout<<r;
}

#include<bits/stdc++.h>
/*
*
* Created By : Mostafa Mahmoud
*
*/

#define sareeeee3 ios_base::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL);
using namespace std;
#define ll long long
#define F first
#define S second
const int N = 2e5 + 9;
ll MOD = 600 + 3;
#define deb(x) cout<<#x<<"="<<x<<"\n";
void result() {
    vector<ll> a= {3, 5, 7, 8, 9};
    ll n{};
    cin>>n;
    if(n <= 3){
        cout << 2 * n + 1;
    }
    else if((n - 1)%3 == 0){
        n -= 1;
        cout << (n / 3 + 1) * 4;
    }
    else if((n - 1)%3 == 1){
        n -= 1;
        cout << (n / 3 + 1) * 4 + 1;
    }
    else if((n - 1)%3 == 2){
        n -= 1;
        cout << (n / 3 + 1)*4+3;
    }

}

int main() {
    sareeeee3
    ll tt = 1;
    //  cin >> tt;
    for (int i = 0; i < tt; i++) {
        result();
        cout << "\n";
    }
}

#include <bits/stdc++.h>
#define MAX 200000
#define int long long
using namespace std;
int n,ANS;
signed main()
{
    cin >> n;
    int st = 1, dr = INT_MAX;
    while(st <= dr)
    {
         int mid = (st + dr) >> 1;
         int g = (mid - 1)/ 2 + max(0LL,mid / 4 - 1);
         if(g >= n)
            dr = mid - 1, ANS = mid;
         else st = mid + 1;
    }
    cout << ANS;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i;

    cin>>n;
   if(n == 1)
    {
        cout<<"3"<<endl;

    }
    if(n == 2)
    {
        cout<<"5"<<endl;

    }

  else if(n>=3)
  {
      i=floor(n/3);
  cout<<n+i+3<<endl;
  }

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
ll n;
bool check(ll curr_ele)
{
  ll curr_pos=0;
  if(curr_ele>=3)
  {
    curr_pos+=(curr_ele-3)/2+1;
  }
  if(curr_ele>=8)
  {
    curr_pos+=(curr_ele-8)/4+1;
  }
  return curr_pos<n;
}
int main()
{
  cin>>n;
  ll l=1;
  ll r=1e18;
  while(l<=r)
  {
    ll mid=(l+r)>>1;
    if(check(mid)==true)
    {
      l=mid+1;
    }
    else
    {
      r=mid-1;
    }
  }
  cout<<l<<endl;
}

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define endl "\n"

const int MOD = 1e9 + 7;

void solve(){
    int n; cin >> n;
    int lo = 1;
    ll hi = 2e9 + 1;
    while(lo < hi){
        ll mid = (lo + hi) / 2;
        ll bad = mid / 2 + 1;
        bad -= mid / 4;
        if(mid >= 4) bad++;
        //cout << "Mid: "<< mid << " bad: "<< bad << endl;
        if(mid - bad >= n) hi = mid;
        else lo = mid + 1;
    }
    cout << hi << endl;
}

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    //int tt; cin >> tt;
    int tt = 1;
    while(tt--) solve();
}

#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <map>
#include <queue>
using namespace std;
typedef long long LL;
typedef pair<LL, int> PLI;
int n;
bool cheak(LL mid)
{
	LL pos = 0;
	if (mid >= 3) pos += (mid-3)/2+1;
	if (mid >= 8) pos += (mid - 8) / 4 + 1;
	return pos < n;
}
void sovle()
{
	cin >> n;
	LL l = 3, r = 1e10;
	while (l <r)
	{
		LL mid = (l + r) >> 1;
		if(cheak(mid)==true) l = mid + 1;
		else r = mid;
	}
	cout << l << endl;
}

int main()
{
  sovle();
	return 0;
}

#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <map>
#include <queue>
using namespace std;
typedef long long LL;
typedef pair<LL, int> PLI;
int n;
bool cheak(LL mid)
{
	LL res = 0;
	if (mid >= 3) res += (mid - 3) / 2 + 1;
	if (mid >= 8) res += (mid - 8) / 4 + 1;
	return res < n;
}
void sovle()
{
	cin >> n;
	LL l = 3, r = 1e10;
	while (l <r)
	{
		LL mid = (l + r) >> 1;
		if(cheak(mid)==true) l = mid + 1;
		else r = mid;
	}
	cout << l << endl;
}

int main()
{
  sovle();
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

const ll mod  = 1e9 + 7;
const ld eps  = 1e-9 ;
const ll maxn = 1e5+1;
const ll inf  = 5e18 ;
const ll minf = -inf ;

#define mp make_pair
#define pb push_back
#define endl "\n"

ll check(ll n)
{
    ll ans = (n-1)/2;
    if(n >=4 )
    ans += n/4 - 1;
    return ans;
}

bool solve()
{
    ll n; cin>>n;
    ll low = 3, high = 1e18;
    ll ans;
    // cout<<check(109)<<endl;
    while(low <= high)
    {
        ll mid = (low + high)/2;
        ll c = check(mid);

        if( c >= n)
        {
            ans = mid;
            high = mid-1;
        }
        else
        {
            low = mid+1;
        }
        // cout<<low<<" "<<high<<endl;
    }
    cout<<ans<<endl;
    return true;
}

int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    #ifdef NOW
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    freopen("error.txt","w",stderr);
    #endif
    ll t=1;
    // cin >> t;
    while(t--)
    {
        if(solve())
        {
            // cout << "YES" << endl;
        }
        else
        {
            // cout << "NO" << endl;
        }
    }

    return 0;
}

#include <bits/stdc++.h>

#ifdef LOCAL_T4M0FEY
#include "debug.h"
#else
#define debug(x...) 228
#endif

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

#define fi first
#define se second

const int inf = int(1e9) + 1;
const ll infll = ll(1e18) + 1;
const int mod = int(1e9) + 7;
mt19937_64 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());

template<typename T1, typename T2>
bool chmin(T1 &a, T2 b){
    if (a > b) return a = b, true;
    return false;
}
template<typename T1, typename T2>
bool chmax(T1 &a, T2 b){
    if (a < b) return a = b, true;
    return false;
}
void solve_case(){
    ll left = 0, right = infll;
    int n;
    cin >> n;
    if (n == 1) {
        cout << 3 << endl;
        return;
    }
    while (right - left > 1){
        ll mid = (left + right) / 2;
        if (mid - (mid / 4 + 1) >= n){
            right = mid;
        }
        else{
            left = mid;
        }
    }
    cout << right + 2 << "\n";
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
#ifdef LOCAL_T4M0FEY
    freopen("inputik.txt", "r", stdin);
    clock_t tStart = clock();
#endif
    int T = 1;
    while (T--){
        solve_case();
    }
#ifdef LOCAL_T4M0FEY
    fprintf(stderr, "\n>> Runtime: %.10fs\n", (double) (clock() - tStart) / CLOCKS_PER_SEC);
#endif
}

#include <bits/stdc++.h>

using namespace std;

int main()
{

    unsigned long long n;
    cin >> n;
    if(n==1)
    {
       cout << 3<<endl;
    }
    else if((n-1)%3==0)
    {
       cout << (((n-1)/3)+1)*4<<endl;
    }
    else if(n%3==0)
        cout << 3 + 2 * ((n)-(int)(n/3))<<endl;
    else
        cout << 3 + 2 * ((n-1)-(int)(n/3))<<endl;

}

#include<bits/stdc++.h>
using namespace std;
long long read(){
	long long x=0,sgn=1;char ch=getchar();
	while(ch<'0' || ch>'9'){if(ch=='-')sgn=-1;ch=getchar();}
	while(ch>='0' && ch<='9'){x=(x<<3)+(x<<1)+(ch&15);ch=getchar();}
	return x*sgn;
}
void write(long long n,bool p){
	if(n<0){putchar('-');n=-n;}
	if(n==0){if(p)putchar('0');return;}
	write(n/10,0);putchar(n%10+'0');
}
long long n,a[10];
int main(){
	n=read();
	if(n==1){cout<<"3";return 0;}
	if(n==2){cout<<"5";return 0;}
	if(n==3){cout<<"7";return 0;}
	if(n==4){cout<<"8";return 0;}
	if(n%3==0)cout<<7+(n/3-1)*4;
	if(n%3==1)cout<<8+(n/3-1)*4;
	if(n%3==2)cout<<5+(n/3)*4;
	return 0;
}

#include <bits/stdc++.h>
#define kareem ios_base::sync_with_stdio(false);cin.tie(0);
#define BIG 9223372036854775807
#define mod 1000000007
typedef long long ll;
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>

void go(){
    ll n;
    cin >> n;
    if(n==1)
        cout << 3 ;
    else if (n==2)
        cout << 5 ;
    else
        cout << 3+4*(n/3)+n%3 ;
}
int main(){
    kareem
    int t=1;
    //cin >> t;
    while(t--){
        go();
    }
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main ()
{
    int n;
    cin >> n;
    int cnt = 1;
    int a = 3;
    int b = 8;
    while(1){
        if (cnt == n){
            cout << min(a , b);
            return 0;
        }
        if (a < b)
            a += 2;
        else
            b += 4;
        cnt ++;
    }
    return 0;
}

#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define all(x) x.begin(),x.end()
#define ll long long
#define pb push_back
#define vec(d) vector<d>
#define cin(x) for(auto &i:x)cin>>i;
#define copy(x,y) for(int i = 0 ; i < x.size();i++)x[i]=y[i];
using namespace std;
const ll MOD = 1000000007;
const double PI = 3.14159265358979323846;
int find(vector<auto> v,auto target)
{
    for (int i = 0; i < v.size(); i++)
    {
        if(v[i]==target)
            return i;
    }
    return -1;
}
int rfind(vector<auto> v,auto target)
{
   for (int i = v.size()-1; i >= 0; i--)
    {
        if(v[i]==target)
            return i;
    }
    return -1;
}
int a[2]; // put the size that depends on the constraints
int seg[4*2]; // multiply the size by 4
int count;
void update(int node,int low , int high, int i,int val) // update the the name and the code inside according to the problem
{
   if(low == high)
   {
    seg[node]=val;
   return ;
   }
   int mid = (low+high)/2;
   if(i<=mid)
	  update(2*node+1,low,mid,i,val);
   else
     update(2*node+2,mid+1,high,i,val);
   if(::count&1)
    seg[node]=seg[2*node+1]^seg[2*node+2];
    else
    seg[node]=seg[2*node+1]|seg[2*node+2];
   ::count++;
}
void solve()
{
   ll n;
   cin>>n;
   if(n==1)
    cout<<3;
   else
    cout<<4*n/3+3;
}
int main()
{
   FAST;
   int t=1;
   //cin>>t;
   while(t--)
     solve();
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define vec vector<int>
#define endl "\n"
#define uint unsigned int
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL)
#define pb push_back

int main() {
	//FASTIO;
	ll n; cin >> n;
	if (n == 1) cout << 3;
	else if (n == 2) cout << 5;
	else {
		int a = 3;
		a += n / 3;
		cout << n + a;
	}
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int maxn=1e5+10;
int n,m,t;

signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int n;
	cin>>n;
	if(n==1){
		cout<<3<<endl;
		return 0;
	}
	else if(n==2){
		cout<<5<<endl;
		return 0;
	}
	else if(n>=3){
		t=(n)/3;
		cout<<n+3+t<<endl;
		return 0;
	}
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
long long n;
long long read(){
	char ch=getchar();
	long long sgn=1,x=0;
	while(ch<'0'||ch>'9'){
		if(ch=='-'){
			sgn=-1;
		}
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=(x<<3)+(x<<1)+(ch&15);
		ch=getchar();
	}
	return x*sgn;
}
void write(long long n,bool p){
	if(n<0){
		putchar('-');
		n=-n;
	}
	if(n==0){
		if(p==true){
			putchar('0');
		}
		return;
	}
	write(n/10,0);
	putchar(n%10+'0');
}
int main(){
	cin>>n;
	if(n==1){
		cout<<3<<endl;
	}else if(n==2){
		cout<<5<<endl;
	}else if(n==3){
		cout<<7<<endl;
	}else if(n==4){
		cout<<8<<endl;
	}else if(n%3==1){
		cout<<8+(n/3-1)*4<<endl;
	}else if(n%3==2){
		cout<<5+n/3*4<<endl;
	}else if(n%3==0){
		cout<<7+(n/3-1)*4<<endl;
	}
	return 0;
}

// 0 to 4,294,967,295 UN_SIGNED INT SIZE
// transform(s.begin(), s.end(), s.begin(), ::toupper);
// APNA KAM KER ,|,,
//  ******* *     *   ********   *      *
//  *       *     *   *          *    *
//  *       *     *   *          *  *
//  ****    *     *   *          *  *
//  *       *     *   *          *    *
//  *       *******   ********   *      *
#include <bits/stdc++.h>
#define mx INT_MAX
#define mi INT_MIN
#define ll long long int
#define fr(i, a, x) for (int i = a; i < x; ++i)
#define vr(x) vector<ll> x
#define ss second
#define f first
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define mk(x, y) make_pair(x, y)
#define MOD 1000000007
#define Integer_MAX_VALUE 0x7fffffff
#define Integer_MIN_VALUE 0x80000000
#define Long_MAX_VALUE 0x7fffffffffffffffL
#define Long_MIN_VALUE 0x8000000000000000L
#define nl '\n'

using namespace std;

int gcd(int a, int b)
{
    while (b != 0)
    {
        a %= b;
        a ^= b;
        b ^= a;
        a ^= b;
    }
    return a;
}

bool isPerfectSquare(long double x)
{

    if (x >= 0)
    {

        long long sr = sqrt(x);
        return (sr * sr == x);
    }
    return false;
}

int lcm(int a, int b)
{

    return a / gcd(a, b) * b;
}

void solve()
{
    ll n;
    cin >> n;

    if (n == 4)
    {
        cout << 8;
        return;
    }

    if (n == 1)
    {
        cout << 3;
        return;
    }

    if (n == 2)
    {
        cout << 5;
        return;
    }

    if (n == 3)
    {
        cout << 7;
        return;
    }

    if (n == 5)
    {
        cout << 9;
        return;
    }

    if (n == 6)
    {
        cout << 11;
        return;
    }

    if (n % 3 == 1)
    {
        cout << 8 + (n / 3 - 1) * 4;
    }
    else
    {
        if (n % 3 == 0)
        {
            cout << 11 + (n / 3 - 2) * 4;
        }
        else
        {
            cout << 9 + (n / 3 - 1) * 4;
        }
    }
}

int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int t = 1;

    // cin >> t;

    while (t--)
    {

        solve();
    }
    return 0;
}

#include <bits/stdc++.h>
#define INT long long
using namespace std;

int main(){
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif
	int n; scanf("%d", &n);
	if(n == 1) cout << 3 << endl;
	else if(n == 2) cout << 5 << endl;
	else {
		n -= 2;
		int r = n/3;
		int rr = n%3;
		if(rr == 0){
			printf("%lld\n", 6ll + 1ll*4*r-1);
		}
		else {
			printf("%lld\n", 6ll+1ll*4*r+rr);
		}
	}
	return 0;
}

#include <bits/stdc++.h>
#define INT long long
using namespace std;

int main(){
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif
	int n; cin>>n;
	if(n==1) cout<<3<<endl;
	else if(n==2) cout<<5<<endl;
	else {
		n-=2;
		int r=n/3;
		int rr=n%3;
		if(rr==0) cout<<6 + 1ll*4*r-1<<endl;
		else {
			 INT ans = 6+1ll*4*r+rr;
			cout<<ans<<endl;
		}
	}
	return 0;
}

#include<bits/stdc++.h>
using namespace std;

int main()
{
     long long int n;
    cin>>n;
  long long   int x=(3+1)*n+3*3;
    if(n==1)
    cout<<(x/3)-1;
   else
   cout<<x/3;

}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define line "\n"
#define vi vector<ll>
#define mi map<ll,ll>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define PI 3.141592653589793238462
#define check(x) cout<<"Check#"<<x<<line;
#define p_c(x) __builtin_popcountll(x)
#define show(x) for(auto it:x)cout<<it<<" ";
typedef unsigned long long ull;
typedef long double lld;
const ll int MX=1e9+7;
void Case(ll int x,ll int t){cout<<"Case #"<<x-t<<": ";}

#ifndef ONLINE_JUDGE
#define debug(x) cerr << #x <<" "; _print(x); cerr << endl;
#else
#define debug(x)
#endif

void _print(ll t) {cerr << t;}
void _print(int t) {cerr << t;}
void _print(string t) {cerr << t;}
void _print(char t) {cerr << t;}
void _print(lld t) {cerr << t;}
void _print(double t) {cerr << t;}
void _print(ull t) {cerr << t;}

template <class T, class V> void _print(pair <T, V> p);
template <class T> void _print(vector <T> v);
template <class T> void _print(set <T> v);
template <class T, class V> void _print(map <T, V> v);
template <class T> void _print(multiset <T> v);
template <class T, class V> void _print(pair <T, V> p) {cerr << "{"; _print(p.ff); cerr << ","; _print(p.ss); cerr << "}";}
template <class T> void _print(vector <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(set <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(multiset <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T, class V> void _print(map <T, V> v) {cerr << "[ "; for (auto i : v) {_print(i); cerr << " ";} cerr << "]";}
/******************************************/
ll binpow(ll a,ll b,ll m) {
    a%=m;
    ll res=1;
    while(b>0){
        if(b&1)res=res*a%m;
        a=a*a%m;
        b>>=1;
    }
    return res;
}
void decToBinary(ll n){
    for(int i= 10;i>=0;i--){
        ll int k=n>>i;
        if(k&1)cout<<"1";
        else cout<<"0";
    }
}
/*******************************************/

const int X=2*1e5+1;
// vi gh[X];
// ll int vis[X];
// ll int dp1[X],pr[X];
// const int X1=100;

/*

*/
bool chk(ll int mid,ll int n){
    ll int odd=(mid)/2;
    if(mid%2==0)odd--;
    if(odd<0)odd=0;
    ll int four=(mid)/4-1;
    if(four<0)four=0;
    return ((odd+four)>=n);
}
void solve(){
    ll int n;
    cin>>n;
    ll int l=1,r=1e17;
    ll int ans=0;
    while(l<=r){
        ll int mid=(l+r)/2;
        if(chk(mid,n)){
            ans=mid;
            r=mid-1;
        }
        else{
            l=mid+1;
        }
    }
    cout<<ans<<line;

}

int main() {
    #ifndef ONLINE_JUDGE
        freopen("Error.txt", "w", stderr);
    #endif
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    ll int t=1;
    // cin>>t;
    // ll int x=t;
    while(t--){
        // Case(x,t);
        solve();
    }
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define speed ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz(x) (int)(x.size())
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define gcd __gcd
#define nl '\n'
#define no cout << "NO\n";
#define yes cout << "YES\n";

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair <int, int> pii;

const int N = 1e5+5;
const ll INF = LLONG_MAX;
const int inf = INT_MAX;
const ll MOD = 1e9+7;
const double EPS = 1e-9;

void bf(){
	set <ll> v;
	for(int i = 2; i <= 1000; i++)
		for(int j = 1; j < i; j++)
			v.insert({i*i-j*j});

	vector <int> vec;
	vec.insert(vec.begin(), all(v));

	int cnt = 1;
	for(ll x : vec){
		cout << x << ' ';
		if(cnt % 10 == 0)
			cout << nl;
		cnt++;
	}
	cout << nl;
}

void solve(){
	ll i;
    cin >> i;
    if(i == 1)
    	cout << 3 << '\n';
    else if (i%3==1)
    	cout<<(i+2)/3*4;
    else
    	cout<<(i-(i-1)/3)*2+1;
}

int main(){
  	//freopen("main.in","r",stdin);
  	//freopen("main.out","w",stdout);
  	speed;
  	int T = 1;
  	while(T--)
  		solve();
 	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define ts(s) to_string(s)
#define endl "\n"
#define ff first
#define ss second
#define yes cout<<"YES"
#define no cout<<"NO"
#define vi vector<int>
#define mii map<int, int>
#define pi pair<int, int>
//stoi(string) -> int

ll mod = 1e9 + 7;
int n;
bool isok(int x)
{
	return (x/4-1+(x+1)/2-1)>=n;
}
void solve ()
{

	cin>>n;
	if(n==1)
	{
		cout<<3;
		return;
	}

	int hi=2e9,lo=0,ans=0;
	while(hi-lo>1)
	{
		int mid=(hi+0LL+lo)/2;
		if(isok(mid))
		     hi=mid;
		else lo=mid+1;
	}
	if(!isok(lo)||lo%4==2||lo==1||lo==4)
		cout<<hi;
	else cout<<lo;

}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(0);
	int t = 1, i = 1;
	//cin >> t;
	while (t--)
	{
		// cout << "Case #" << i++ << ": ";
		solve();
		cout << endl;
	}
	return 0;
}

#include<bits/stdc++.h>
#define ll long long
using namespace std;
int loc[3]={0,1,3};
void Solve(ll n){
	if(n==1) printf("3\n");
	else{
		n+=2;
		printf("%lld\n",(n/3)*4+loc[n%3]);
	}
}
int main(){
	ll n;
	scanf("%lld",&n);
	Solve(n);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
long long n,res;
int main()
{
    cin>>n;
    if(n==1){
        res=3;
    }else{
        res=4;
        res+=(4*((n-1)/3));

        if((n-1)%3==1)res+=1;
        else if((n-1)%3==2)res+=3;
    }
    cout<<res;
    return 0;
}

/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include<iostream>
#include<bits/stdc++.h>
#include<map>
#include<climits>
#include<cmath>
#include<cstdlib>
#include<iterator>
#include<sstream>
using namespace std;
#define vl vector<ll>
#define vvl vector<vl>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define ll long long int
const ll inf=1e9,MOD=1e9+7;
const int largeInt=1e6;
const int N=1e7;
vector<bool> primes(N,true);
vector<int> pr;
int cnt_primes=0;

void seieve(){
    for(int i=2;i*i<=N;i++){
        if(primes[i]==true){

        for(int j=i*i;j<=N;j+=i){
            primes[j]=false;
        }
        }
    }
    for(int i=2;i<=N;i++){
        if(primes[i]){ pr.push_back(i);
        cnt_primes+=1;
        }
    }
}
vector<int> rotateArr(vector<int> &vect,int k,int n){
    vector<int> temp(vect.size());
    for(int i=0;i<vect.size();i++){
        temp[(i+k)%vect.size()]=vect[i];
    }
    return temp;
}
int fib(int n){
int prev=1,prev2=0;
repeq(i,2,n){
    int curr=prev+prev2;
    prev2=prev;
    prev=curr;

}
return prev;
}

ll stToInt(string &str){
    stringstream ss(str);
    ll x=0;
    ss>>x;
    return x;

}
bool isPrime(ll x){
    if(x<=1)
    return false;
    for(int i=2;i<=sqrt(x);i++){
        if(x%i==0)
        return false;
    }
    return true;
}

bool checkPalindrome(string& str){
    int n=str.size();
    int start=0,end=n-1;
    while(start<=end){
        if(str[start]!=str[end])
        return false;
        start++;
        end--;
    }
    return true;
}
vl revArr(vl&vect){
    int n=vect.size();
    int start=0,end=n-1;
    while(start<=end){
        swap(vect[start],vect[end]);
        start++;
        end--;
    }
    return vect;
}

string revStr(string&str){
    int n=str.size();
    int start=0,end=n-1;
    while(start<=end){
        swap(str[start],str[end]);
        start++;
        end--;
    }
    return str;
}
void primeSieve(vector<int> & prime){
    // rep(i,2,largeInt){
        for( int i=2;i<1e4;i++){
    if(prime[i]==0){
        for(int j=i*i;j<1e5;j+=i){
            prime[j]=1;
        }
    }
}
}
void isPalindrome(int ind,string &str,bool &flag,int n){
    if(ind==n){
        return;
    }

    swap(str[ind],str[ind+2]);
    isPalindrome(ind+1,str,flag,n);
    if(checkPalindrome(str)) flag=true;
    swap(str[ind],str[ind+2]);
    isPalindrome(ind+1,str,flag,n);
    if(checkPalindrome(str)) flag=true;

}
int gcd(int a, int b)
{
    return b == 0 ? a : gcd(b, a % b);
}
// int f(int ind,int D,int k,vector<int>&prime){
//     if(D==0) return 0;
//     if(ind==k-1){
//         if(D<=prime[k-1]) return 0;
//         else return 1e9;
//     }
//     int not_take=f(ind+1,D,k,prime);
//     int take=1e9;
//     if(D>=prime[ind]) take=1+f(ind,D,k,prime);

//     return min(take,not_take);

// }
// int f(int i,int j,vector<bool>& vect,vector<int>&dp){
//     if(i>=vect.size()) return 0;
//     if(dp[i]!=-1) return dp[i];
//     int bot=0;
//     if(vect[i]==0){
//         vect[i]=1;
//     bot=1+min(f(i+5,j,vect,dp),f(i+4,j,vect,dp));

//     }
//     return dp[i]=bot;

// }
int bSearch( vector<int>&vect,int i,int start,int end,int target,vector<int>&ans){
    if(start<=end){
        int mid=(start+end)/2;
        if(vect[mid]==target){
            ans[i]=vect[mid];
        return mid;
        }
        else if(target<vect[mid]){
            //  if(ans[i]<vect[mid] && vect[mid]<=target)
            //  ans[i]=mid;
        return bSearch(vect,i,start,mid-1,target,ans);
        }
        else{
            if(ans[i]<vect[mid] && vect[mid]<=target)
            ans[i]=mid;
        return bSearch(vect,i,mid+1,end,target,ans);
        }
    }
    return -1;
}
void find(vector<int>& vect1,int i,vector<int> &ans,priority_queue<pair<int,int>> &pq){
    priority_queue<pair<int,int>> g=pq;
    while(!g.empty()){
     int k=g.top().first;
     g.pop();
     if(k<=vect1[i] && i!=g.top().second){
     ans[i]=k;
     break;
     }
    }
}
int main(){

        ios_base::sync_with_stdio(false);
        cin.tie(nullptr);
        ll n;
        cin>>n;
        ll l=3,h=3*n+1;
        ll ans=-1;
        while(l<=h){
        ll mid=l+h>>1;
        ll count=0;
        if(mid>=8){
            count=mid/4-1;
            if(mid&1) count+=(mid/2);
            else
            count+=(mid/2) -1;
        }
else{
        if(mid&1) count+=(mid/2);
            else
            count+=(mid)/2 -1;}
        if((count==n && mid&1) ||(count==n && mid%4==0 && mid>=8) ) { ans=mid;break;}
        else if(count==n){ans=mid-1;break;}
        if(count>n)h=mid-1;
        if(count<n) l=mid+1;
        }

        cout<<ans<<endl;
        return 0;
    }

#include<bits/stdc++.h>
using namespace std;

#define ll long long int
#define dd double
#define sg string
#define modd 1000000007
#define en "\n"
#define sc(a) scanf("%lld",&a);
#define f(i,a,n) for(ll i=a;i<n;i++)
#define ps(a) printf("%lld ",a);
#define pn(a) printf("%lld\n",a);

int main()
{
    //freopen("in.txt", "r", stdin);
    ll a,b,c,d,t,mm,k,aa,bb,n,m;

    sc(n)
    if(n==1){
        pn(3LL)
        return 0;
    }

    ll l,r,mid,count;
    l = 0;r = 1e18;
    while(l<r){
        mid = (l+r)/2;
        count = mid - (mid+2)/4 - 2;
        if(count>=n) r = mid;
        else l = mid+1;
    }

    pn(l)

    return 0;
}

#include<bits/stdc++.h>
using namespace std;

#define ll long long int
#define dd double
#define sg string
#define modd 1000000007
#define en "\n"
#define sc(a) scanf("%lld",&a);
#define f(i,a,n) for(ll i=a;i<n;i++)
#define ps(a) printf("%lld ",a);
#define pn(a) printf("%lld\n",a);

int main()
{
    //freopen("in.txt", "r", stdin);
    ll a,b,c,d,t,mm,k,aa,bb,n,m;

    sc(n)
    if(n==1){
        pn(3LL)
        return 0;
    }

    ll l,r,mid,count;
    l = 0;r = 1e18;
    while(l<r){
        mid = (l+r)/2;
        count = mid - (mid+2)/4 - 2;
        if(count>=n) r = mid;
        else l = mid+1;
    }
    pn(l)

    return 0;
}

#include<bits/stdc++.h>

using namespace std;

#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define MOD 1000000007
#define MOD1 998244353
#define INF 1e18
#define nline "\n"
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define ff first
#define ss second
#define PI 3.141592653589793238462
#define set_bits __builtin_popcountll
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double lld;
// typedef tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update > pbds; // find_by_order, order_of_key

#ifndef ONLINE_JUDGE
#define debug(x) cerr << #x <<" "; _print(x); cerr << endl;
#else
#define debug(x)
#endif

void _print(ll t) {cerr << t;}
void _print(int t) {cerr << t;}
void _print(string t) {cerr << t;}
void _print(char t) {cerr << t;}
void _print(lld t) {cerr << t;}
void _print(double t) {cerr << t;}
void _print(ull t) {cerr << t;}

template <class T, class V> void _print(pair <T, V> p);
template <class T> void _print(vector <T> v);
template <class T> void _print(set <T> v);
template <class T, class V> void _print(map <T, V> v);
template <class T> void _print(multiset <T> v);
template <class T, class V> void _print(pair <T, V> p) {cerr << "{"; _print(p.ff); cerr << ","; _print(p.ss); cerr << "}";}
template <class T> void _print(vector <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(set <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(multiset <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T, class V> void _print(map <T, V> v) {cerr << "[ "; for (auto i : v) {_print(i); cerr << " ";} cerr << "]";}
#define fori(i,s,n) for (int i = s; i <n; ++i)
#define ford(i,n,e) for (int i = n; i >=e ; i--)

void solve(){
ll n;
cin>>n;

if(n==1)
{
	cout<<3<<endl;
}else if(n==2)
{
	cout<<5<<endl;
}else
{
	n-=2;

	if(n%3==0)
	{
		cout<<6+(n/3)*3+n/3-1<<endl;
	}else
	{
		cout<<6+(n/3)*3+n/3+(n%3)<<endl;
	}
}

}

int main() {
#ifndef ONLINE_JUDGE
	freopen("Error.txt", "w", stderr);
#endif

int t=1;
while(t--){

	solve();
}
}

#include<bits/stdc++.h>
using namespace std;

#define ll long long int
#define dd double
#define sg string
#define modd 1000000007
#define en "\n"
#define sc(a) scanf("%lld",&a);
#define f(i,a,n) for(ll i=a;i<n;i++)
#define ps(a) printf("%lld ",a);
#define pn(a) printf("%lld\n",a);

int main()
{

    //freopen("in.txt", "r", stdin);
    ll a,b,c,d,t,mm,k,aa,bb,n,m;

    sc(n)
    if(n==1){
        pn(3LL)
        return 0;
    }
    ll l,r,mid,count;
    l = 0;r = 1e18;
    while(l<r){
        mid = (l+r)/2;
        count = mid - (mid+2)/4 - 2;
        if(count>=n) r = mid;
        else l = mid+1;
    }
    pn(l)

    return 0;
}

#include<bits/stdc++.h>
using namespace std;

#define ll long long int
#define dd double
#define sg string
#define modd 1000000007
#define en "\n"
#define sc(a) scanf("%lld",&a);
#define f(i,a,n) for(ll i=a;i<n;i++)
#define ps(a) printf("%lld ",a);
#define pn(a) printf("%lld\n",a);

int main()
{
    //freopen("in.txt", "r", stdin);
    ll a,b,c,d,t,mm,k,aa,bb,n,m;

    sc(n)
    if(n==1){
        pn(3LL)
        return 0;
    }
    ll l,r,mid,count;
    l = 0;r = 1e18;
    while(l<r){
        mid = (l+r)/2;
        count = mid - (mid+2)/4 - 2;
        if(count>=n) r = mid;
        else l = mid+1;
    }
    pn(l)

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define sz(a) int((a).size())
#define fi first
#define se second
#define pb push_back
#define ios ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define en "\n"
#define getbit(i,j) ((i>>j)&1)
#define cnt_bit(x) __builtin_popcount(x)
#define LOG 20
const int dx[]={-1,0,1,0};
const int dy[]={0,1,0,-1};
const int N=1e6+5;
const int mod=1e9+7;
bool maximize(int &x, int y){if (x<y){x=y;return 1;}return 0;}
bool minimize(int &x, int y){if (x>y){x=y;return 1;}return 0;}
void add(int &x, const int &y) {x += y;if (x >= mod) x -= mod;}
void sub(int &x, const int &y) {x -= y;if (x < 0) x += mod;}
typedef pair<int , int > ii;
typedef pair<int , ii> iii;
struct edge {
    int u,v,c;
    edge(){}
    edge(const int &_u,const int &_v,const int &_c) {
        u=_u;v=_v;c=_c;
    }
    bool operator < (const edge &x) const {
        return (c<x.c);
    }
};
ll n,l,r,ans;

bool check(long long x)
{
    ll dem=(x-1)/2+max(x/4-1,0ll);

    return dem>=n;
}

int main()
{
    cin>>n;

    l=1;
    r=1e16;

    while (l<=r)
    {
        ll mid=(l+r)/2;

        if (check(mid))
            r=mid-1,ans=mid;
        else l=mid+1;
    }

    cout<<ans;
}

#include <bits/stdc++.h>
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
using namespace std;
using ll = signed long long int;

constexpr size_t nmax = 1000000+ 15;

ll n;

bool check(ll mid);
void sift();

bool nprime[nmax];
vector<ll> prime;
void sift() {
	prime.push_back(1);
	for (ll i = 2; i <= 1000000; ++ i) {
		if (nprime[i]) continue;
		prime.push_back(i);
		for (ll j = i * 2; j <= 1000000; j += i) nprime[j] = true;
	}
}

bool check(ll mid) {
	ll cnt = 0;
	for (ll i = 1; i <= 2; ++ i) {
		if (i * (i + 2) > mid) break;
		ll j = mid / i;
		while (i * j <= mid) ++ j;
		while (i * j > mid) -- j;
		if (j % 2 != i % 2) -- j;
		cnt += (j - i) / 2;
	}
	return cnt >= n;
}

int32_t main() {
	if (fopen("G.inp", "r")) {
		freopen("G.inp", "r", stdin);
		freopen("G.out", "w", stdout);
	}
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(nullptr); std::cout.tie(nullptr);
	//sift();
	cin >> n;
	ll l = 3, r = 1e13;
	ll res = r;
	while (l <= r) {
		ll mid = (l + r) >> 1;
		if (check(mid)) {
			r = mid - 1;
			res = mid;
		} else l = mid + 1;
	}
	cout << res << "\n";
	return 0x0;
}

/// code by Eastern Tra Tra

//Srayan Bhattachrayya JU EE
#include<bits/stdc++.h>
using namespace std;
#define ll long long

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n; cin >> n;
    ll n1 = 4 * (n / 3) + (3 + (n % 3));
    if (n == 1) cout << 3 << "\n";
    else if (n == 2) cout << 5 << "\n";
    else cout << n1 << "\n";
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define vi vector<int>
#define vvi vector<vi>
#define in cin >>
#define say cout <<
#define new_l cout << "\n";
#define ull unsigned long long int
#define pb push_back
#define pob pop_back
#define pii pair<int,int>
#define vboo vector<bool>
#define yes cout<<"YES";
#define no cout<<"NO";
#define unm unordered_map
#define uns unordered_set
#define ff first
#define ss second
// my defined min and max
int Max(int a, int b){
    if(a<=b)return b;
    else return a;
}
int Min(int a, int b){
    if(a>=b)return b;
    else return a;
}

//printf("%.10f", double(ans / 2.0)); decimal precision
// code here
#define mod (int)(2e9)
// For regular polygon 180 - interior angle should be divisible by 360

int total(int  n){
    int odd = (n+1)/2 - 1;
    int divBy4 = (n/4) - 1;
    return (odd + divBy4);
}
void solve(){
   int n; in n;
   // nth min.
   // b^2 - a^2 = c^2
   //say "Called";
   int s = 3, e = mod;
   while(s<=e){
     int mid = s+(e-s)/2;
     if(total(mid) == n){
        if(mid&1 || (mid>4 and mid%4 == 0)) {
            say mid;
        }
        else say mid - 1;
        return;
     }
     else if(total(mid) > n){
        e = mid - 1;
     }
     else{
        s = mid + 1;
     }
   }
  // say "loop ends";

}

int32_t main(){
//    #ifndef ONLINE_JUDGE
//         freopen("input.txt", "r", stdin);
//         freopen("output.txt", "w", stdout);
//     #endif
    int tc=1;  //in tc;

    //int idx = 1;
    while(tc--){
       solve();
     new_l
    }
    return 0;
}

#include <iostream>
#include <algorithm>
#include <cstring>
#include<vector>
#include<queue>
#include<stack>
#include<bitset>
#include<set>
#include<map>
using namespace std;
using ll=long long;
using PII=pair<ll,ll>;
void out(string s){cout<<s<<"\n";}
void out(ll x){cout<<x<<"\n";}
void YES(){cout<<"YES"<<"\n";}
void NO(){cout<<"NO"<<"\n";}
ll check(ll x)
{
    return (x>=3ll) + (x-3ll)/2ll  +(x-8ll)/4ll+(x>=8ll);
}
void Solve()
{
    ll x;
    cin >> x;
    if(x==1)
    {
        out(3);
        return;
    }
    ll l = 2,r=5e9+10;
    while(l<=r)
    {
        ll mid = l + r >>1;
        if(check(mid)==x)
        {
            if(mid%2==0 && mid%4!=0)
            {
                mid--;
            }
            out(mid);
            return;
        }
        if(check(mid)>x)
            r=mid-1;
        else
            l=mid+1;
    }
}
int main()
{
    std::ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll t=1;
//    cin>>t;
    while(t--)
    Solve();
}

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int main(){
    ll n;
    scanf("%lld", &n);

    ll t1, t2, ans;
    if(n == 1){
        cout << "3" << "\n";
        return 0;
    }
    else{
        t1 = n / 3;
        t2 = t1 + 3;
        ans = n + t2;
    }
    printf("%lld", ans);
}

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef int ii;
typedef unsigned long long ull;
typedef long long int lint;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
#define shekoo ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
template <typename T>
using ordered_set = tree<T, null_type,less_equal<T>, rb_tree_tag,tree_order_statistics_node_update>;
#define of(m) find_by_order((m)) //random access of ordered set
#define all(v) (v).begin(),(v).end()
#define r_all(v) (v).rbegin(),(v).rend()
#define cnt_0s_lr(x) __builtin_clz(x) //It counts number of zeros before the first occurrence of one(set bit)
#define cnt_0s_rl(x) __builtin_ctz(x) //Count no of zeros ff last tt first occurrence of one(set bit).
#define popcnt(x) __builtin_popcount(x) //Count no of zeros ff last tt first occurrence of one(set bit).
#define s(v) (v).size()
#define endl "\n";
#define NO cout << "NO\n";
#define YES cout << "YES\n";
#define No cout << "No\n";
#define Yes cout << "Yes\n";
#define no cout << "no\n";
#define yes cout << "yes\n";
#define PF push_front
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define rep(i, m) for(ll i=0;i<(m);++i)
#define rep_inv(i,m) for(ll i=(m);i>=0;--i)
#define repn(i,in, m) for(ll i=(in);i<(m);++i)
#define repn_inv(i,m,in) for(ll i=(in);i>=(m);--i)
#define repa(i, x) for(auto &i: x)
#define clr(a) memset((a),0,sizeof(a))
#define clrdp(a) memset((a),-1,sizeof(a))
#define vi vector<int>
#define vll vector<ll>
#define vg vector<pair<ll,ll>>
#define Pi M_PI
#define UNIQUE(c) (c).resize(unique(all(c)) - (c).begin())
#define st_int(s, base) stoi((s), 0 , (base))
#define st_ll(s, base) stoll((s), 0 , (base))
#define ch_st(c) string sch(1, (c))
#define stream(line) istringstream in((line)) //split string by spaces and can be accessed in >> s >> m >> s...
#define least_multiple_of_a(a, l) (((l) - 1) / (a) + 1) * (a) // l -> start value

void print_vec(vector<ll>& v){
    for(ll i=0; i<s(v); i++) cout << v[i] << " ";
    cout << endl
}

/// Main masks operations
ll set_bit(ll num, ll idx, ll value = 1){ return (value) ? (num | (1ll<<idx)) : (num & ~(1ll<<idx)); }
ll get_bit(ll num, ll idx){ return ((num >> idx) & 1ll) == 1; }
ll cnt_bits(ll num){ ll ret = 0; while(num){ if(num%2) ret++; num /= 2; } return ret; }
ll set_all_bits_from_1_n(ll n){ return (1ll<<n)-1; }

int main() {
    shekoo
    ll n; cin >> n;
    if(n == 1) return cout << 3, 0;
    ll ans = ((n*4)/3) + 3;
    cout << ans;
    return 0;
}

#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
using gg = long long;
#define endl "\n"
#define pi acos(-1)
#define pii pair<gg,gg>
#define x first
#define y second
#define ul u<<1
#define ur u<<1|1
gg __gcd(gg a, gg b) { return b ? __gcd(b, a % b) : a; }
const gg N =1e6+10;
const gg M = 4e5 + 10;
gg n, T,m;
bool check(gg mid)
{
	gg res = (mid - 1) / 2 + max(mid / 4 - 1, (gg)0);
	return res >= n;
}
void solve()
{
	cin >> n;
	gg l = 1, r = 3e9;
	while (l < r)
	{
		gg mid = l + r >> 1;
		if (check(mid)) r = mid;
		else l = mid + 1;
	}
	cout << l;

}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	solve();

	return 0;
}

#include<bits/stdc++.h>
using namespace std;

long long k,l=3,r=2000000000;
bool st;

int count(int x){
    int res=0;
    res+=(x&1?(x+1)/2-1:x/2-1);
    if(x>7) res+=x/4-1;
    if(x&1||(x!=4&&x%4==0)) st=true;
    return res;
}

int main(){
    cin>>k;
    while(r>l){
        int mid=(l+r)/2;
        st=false;
        int lev=count(mid);
        if(lev<k) l=mid+1;
        else if(lev==k&&st) r=l=mid;
        else r=mid-1;
    }
    cout<<(l+r)/2<<endl;
}

#include <bits/stdc++.h>
using namespace std;

typedef long long           ll;
typedef unsigned long long  ull;
typedef long double         ld;

#define int                 long long
#define endl                '\n'
#define gap                 ' '
#define dbg(x)              cout<<#x<<" = "<<x<<'\n'
#define print(b)            for(auto &a:b) cout<<a<<' ';
#define printN(b)           for(auto &a:b) cout<<a<<endl;
#define ALL(r)              (r).begin(),(r).end()
#define FASTIO              ios::sync_with_stdio(false);cin.tie(NULL);
#define popcount            __builtin_popcount
#define popcountll          __builtin_popcountll
#define clz                 __builtin_clz
#define ffs                 __builtin_ffs

void solve() {
    int n;
    cin >> n;
    if (n == 1)
        cout << 3 << endl;
    else {
        int lo = 5, hi = 1e18;
        while (lo <= hi) {
            int mid = (lo + hi) >> 1;
            int cnt = mid / 4 + (mid + 1) / 2 - 2;
            if (cnt >= n)
                hi = mid - 1;
            else
                lo = mid + 1;
        }
        cout << lo << endl;
    }
}
signed main() {
    FASTIO

    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }

    return 0;
}

#include<bits/stdc++.h>
using namespace std;

/*
// #pragma comment(linker, "/STACK:268435456");
#include <ext/pb_ds/assoc_container.hpp>
// // // Including tree_order_statistics_node_update
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less_equal<int>,
            rb_tree_tag,
            tree_order_statistics_node_update>
    ordered_set;
*/
//========================TypeDefs===================================//

typedef long long ll;
typedef unsigned long long int ull;
typedef long double ldb;

typedef pair<ll,ll> pll;
typedef pair<int,int> pii;

//=========================MACROS====================================//

// using vl = vector<ll>;
// using vvl = vector<vl>;

#define pb push_back
#define vi vector<int>
#define vll vector<ll>
#define vpll vector<pll>
#define vpii vector<pii>
#define mll map<ll,ll>
#define ff first
#define ss second
#define mp make_pair
#define mt make_tuple
#define le length()
#define be begin()
#define en end()

#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define reprev(i,n) for(ll i=n-1;i>=0;i--)
#define reprev1(i,n) for(ll i=n;i>0;i--)
#define repm(i,m,n) for(ll i=m;i<n;i++)
#define repmrev(i,m,n) for(ll i=n-1;i>=m;i--)

#define PN cout<<"NO\n"
#define PY cout<<"YES\n"

const int inf=INT_MAX;
const ll mod=1e9+7;
const int N=2e5+1;

//=========================FUNCTIONS====================================//

/*
FINDING A POWER N WITHOUT MODULO OPERATION

ll binpow(ll a,ll n){
    ll res=1;
    while(n>0){
        if(a & 1){
            res=res*a;
        }
        a=a*a;
        b >>=1;
    }
    return res;
}
*/

/*
FINDING A POWER N MODULO M

long long binpow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
*/

//SORTING BY SECOND VALUE
/*
bool sortbysec(const pair<int,int> &a,const pair<int,int> &b){
    return (a.second>b.second);
}
*/
/*
RETURNS WHETHER A NUMBER IS PRIME

bool isprime(ll n){
    if(n==1){
        return false;
    }
    ll i=2;
    while(i*i<=n){
        if(n%i==0){
            return false;
        }
        i++;
    }
    return true;
}
*/
/*
//SUM OF DIVISORS
int divisors(ll n){
    ll sum=0;
    for(ll i=1;i*i<=n;i++){
        if(n%i==0){
            sum+=i;
            if(n%(n/i)==0 && i!=n/i){
                sum+=(n/i);
            }
        }
    }
    return sum;
}
*/
/*
RETURNS GCD OF TWO NUMBERS

ll gcd(ll a,ll b){
    if(a==0){
        return b;
    }
    return gcd(b%a,a);
}
*/

/*
//DFS
void dfs(int node){
    vis[node]=1;
    cc[node]=cnt;
    for(int child:arr[node]){
        if(vis[child]==0){
            dfs(child);
        }
    }
}
*/
/*
//BFS
void bfs(int node){
    queue<int> q;
    vis[node]=1;
    q.push(node);
    dist[node]=0;
    while(!q.empty()){
        int curr=q.front();
        q.pop();
        for(int child:arr[curr]){
            if(vis[child]==0){
                dist[child]=dist[curr]+1;
                vis[child]=1;
                q.push(child);
            }
        }
    }
}
//Maximum prime divisor of a number
ll maxPrime(ll n){
    ll mp=-1;
    while(n%2==0){
        mp=2;
        n>>=1;
    }
    while(n%3==0){
        mp=3;
        n/=3;
    }
    for(ll i=5;i*i<=n;i++){
        while (n % i == 0) {
            mp = i;
            n = n / i;
        }
        while (n % (i+2) == 0) {
            mp = i+2;
            n = n / (i+2);
        }
    }
    if(n>4){
        mp=n;
    }
    return mp;
}

ll power(ll a,ll b)
{
    if(a==1||b==0)  return 1;
    ll c=power(a,b/2);
    ll res=1;
    res=c*c;
    if(res>=mod)    res%=mod;
    if(b%2) res*=a;
    if(res>=mod)    res%=mod;
    return res;
}

*/

 //char alpha[]={'a','b','c','d','e','f','g','h','i','j','k','l',
//    'm','n','o','p','q','r','s','t','u','v','w','x','y','z'};

//=========================MAIN====================================//

void solve(){
    ll n;
    cin>>n;
    ll l=1,r=5*n;
    if(n==1){
        cout<<3<<"\n";
        return;
    }
    while(r>l+1){
        ll m=(r+l)/2;
        ll temp=0;
        temp+=(m+1)/2;
        temp--;
        temp+=(m/4);
        temp--;
        if(temp<n){
            l=m;
        }else{
            r=m;
        }
    }
    cout<<r<<"\n";
}

int main(){
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    int t=1;
    //cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	long long n; cin >> n;
	if (n == 1)
	{
		cout << 3 << endl;
		return 0;
	}
	long long ans = 4 * n / 3 + 3;
	cout << ans << endl;
	return 0;
}

#define push_back pb
#include <bits/stdc++.h>

const int maxn = 1e5;
typedef long long ll;
using namespace std;

int dmin[maxn],dmax[maxn];
vector<ll>v;

int main()
{   ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    unsigned long long n;
    cin>>n;
    if(n==1)cout<<3<<endl;
    else cout<<3+n*4/3<<endl;

    return 0;
}

/*
*	Author: datqg
*	Date:
*/
#include <bits/stdc++.h>

using namespace std;

int main() {
	int n;
	cin>>n;
	if (n==1) {
		cout<<"3";
		return 0;
	}
	int temp;
	temp=3;
	int i=5;
	int j;
	j=1;
	while (j<n){
	if (i%4==2) {
		i++;
	}
		else if (i&1==1&&i!=temp) {
				temp=i;
				j++;
				i++;
			}
			else if (i%4==0&&i!=temp) {
				temp=i;
				j++;
				i++;
			}
			else {
				i++;
			}
		}
	cout<<temp;
	return 0;
}

/* Author: dreamToTop
 *
 */

#include<bits/stdc++.h>
using namespace std;
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#ifndef ONLINE_JUDGE
#include <algodebug>
#define debug(x) cerr << #x <<" ";_print(x);cerr << endl;
#define debugArray(x,n) cerr<< #x <<" ";_print(x,n);cerr<<endl;
#else
#define debug(...)
#define fre()
#endif
#define ll long long
#define mod (ll)(1e9+7)
#define tc ll t;cin>>t;while(t--)

void solve(){
  ll n,l=7,r=1e18,calc,mid;
  cin>>n;
  if(n==1){
    cout<<3<<endl;
    return;
  }else if(n==2){
    cout<<5<<endl;
    return;
  }
  while(l<r){
      mid=(l+r)/2;
      calc=mid-(mid/2-mid/4)-2;
      if(calc<n)l=mid+1;
      else r=mid;
  }
  cout<<l<<endl;
}
int main() {
  fastio();
  fre();
  solve();
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<long long> vl;
typedef vector<vector<long long> > vvl;
#define all(a) a.begin(), a.end()
#define pb push_back
#define sq(a) ((a)*(a))
#define NUM 1000000007
#define PI 3.141592653589793238

ll Jadoo(ll n){
    if(n==4 || n==1 || n%4==2) return -1;
    ll r = n-1-(n+1)/4-(n>4);
    return r;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin >> n;
    ll l=0,r=1e10,mid;
    while(r-l>2){
        mid = (l+r)/2;
        if(Jadoo(mid) == -1) mid = mid+1;
        if(Jadoo(mid)>n) r=mid-1;
        else l=mid;
    }
    if(Jadoo(l) == n) cout << l;
    else if(Jadoo(l+1) == n) cout << l+1;
    else cout << r;

    return 0;
}

#include <bits/stdc++.h>

// plociy based ds
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

// order_of_key (k) : Number of items strictly smaller than k .
// find_by_order(k) : K-th element in a set (counting from zero).
using namespace std;
using namespace __gnu_pbds;

// pbds
typedef tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update> pbds; // find_by_order, order_of_key

// macros
#define log 19
#define int long long int
#define F first
#define S second
#define pb push_back
#define si set<int>
#define vi vector<int>
#define vii vector<vector<int>>
#define pii pair<int, int>
#define vpi vector<pii>
#define vpp vector<pair<int, pii>>
#define mii map<int, int>
#define mpi map<pii, int>
#define spi set<pii>
#define endl "\n"
#define sz(x) ((int)x.size())
#define all(p) p.begin(), p.end()
#define double long double
#define Read(v)      \
    for (int &a : v) \
        cin >> a;
#define que_max priority_queue<int>
#define que_min priority_queue<int, vi, greater<int>>
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
#define print(a)          \
    for (auto x : a)      \
        cout << x << " "; \
    cout << endl
#define print1(a)    \
    for (auto x : a) \
    cout << x.F << " " << x.S << endl
#define print2(a, x, y)         \
    for (int i = x; i < y; i++) \
        cout << a[i] << " ";    \
    cout << endl

// debug
template <typename Arg1>
void __f(const char *name, Arg1 &&arg1) { cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&...args)
{
    const char *comma = strchr(names + 1, ',');
    cout.write(names, comma - names) << " : " << arg1 << " | ";
    __f(comma + 1, args...);
}

// power function

inline int power(int a, int b)
{
    int x = 1;
    while (b)
    {
        if (b & 1)
            x *= a;
        a *= a;
        b >>= 1;
    }
    return x;
}
int modpower(int x, int y, int p)
{
    if (y == 0)
        return 1;
    int temp = modpower(x, y / 2, p);
    temp = (1LL * temp * temp) % p;
    if (y & 1)
    {
        temp = (1LL * temp * x) % p;
    }
    return temp;
}
int mmi(int b, int mo)
{
    int inv_b = modpower(b, mo - 2, mo);

    return inv_b;
}

// constant
double pi = 3.14159265358979323846264338327950;
const int mod = 1e9 + 7;
const int N = 5e5 + 5;
int inf = 9e18;
int ninf = -9e18;

// check number is power of 2 or not
bool isPowerOfTwo(int x)
{

    return x && (!(x & (x - 1)));
}

// dsu
// vector<int> pa(N, 0);

// vector<int> Size(N, 0);

// void make(int a)
// {
//     pa[a] = a;

//     Size[a] = 1;
// }

// int get(int a)
// {
//     if (pa[a] == a)
//     {
//         return a;
//     }

//     return pa[a] = get(pa[a]);
// }

// void Union(int a, int b)
// {
//     a = get(a);
//     b = get(b);

//     if (a != b)
//     {
//         if (Size[a] < Size[b])
//         {
//             swap(a, b);
//         }

//         Size[a] += Size[b];
//         pa[b] = a;
//     }
// }

/*********************************************** Main Code ***********************************************/

void solve()
{

    int n;
    cin >> n;

    int l = 0, r = 1e18;

    if(n==1)
    {
        cout << 3 << endl;
        return;
    }

    auto check = [&](int a)
    {

        int x = a / 4 - 1;

        if (a & 1)
        {
            x += a / 2;
        }
        else
        {
            x += a / 2 - 1;
        }

        return n<=x;
    };

    int ans;
    while (l <= r)
    {

        int mid = (l + r) / 2;

        if (check(mid))
        {
            r = mid - 1;
            ans = mid;
        }
        else
        {
            l = mid + 1;
        }
    }
    cout << ans << endl;
}

/*************** main *****************/
int32_t main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    // main code

    int t = 1;
    // cin >> t;

    while (t--)
    {
        solve();
    }

    // debug
    // cerr << "Run Time : " << ((double)(clock() - z) / CLOCKS_PER_SEC);

    return 0;
}

#include <bits/stdc++.h>
#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef long long int lli;
using namespace std;
int main()
{
    fast_io
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
#endif
    /*lli n,d;
    cin>>n>>d;
    vector<lli> v(n);
    for(int i=0;i<n;i++){
        cin>>v[i];
    }
    sort(v.begin(),v.end());
    int a=1,b=n-1,count=0,i=0;
    lli sum=0;
    while(i<b){
        sum+=v[b]*a;
        if(sum>d){
            count++;
            a=1;
            b--;
            sum=0;
        }
        else{
            a++;
        }
        i++;
    }
    cout<<count;*/
    lli n;
    cin >> n;
    if(n==1){
        cout<<3;
        exit(0);
    }
    if(n==2){
        cout<<5;
        exit(0);
    }
    else{
        cout<<n + (n/3) + 3;
    }
}

/**
 *    Jai Mahakaal
 *    author:  Jethalal
 *    created: 10.08.2022 20:00:49
**/
#undef _GLIBCXX_DEBUG

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define f(i,j,n) for(ll i=j;i<n;i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define dtb(n,x) bitset<n>(x).to_string()
#define fs first
#define se second
const double pi = 3.14159265358979323846;
const ll INF = 1e9 + 7;
template<class T> bool ckmin(T&a, T&b) { bool B = a > b; a = min(a, b); return B; }
template<class T> bool ckmax(T&a, T&b) { bool B = a < b; a = max(a, b); return B; }
void init_code() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    srand(time(NULL));
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
ll powermode(ll n, ll k, ll inf) {
    if (k == 0) return 1LL;
    ll ans = powermode(n, k / 2LL, inf);
    ans = (ans * ans) % inf;
    if (k % 2LL) {
        ans = (ans * n) % inf;
    }
    return ans % inf;
}
ll gcd(ll a, ll b) {
    return b ? gcd(b, a % b) : a;
}
ll find_set(ll x, vector<ll> &par) {
    return (x == par[x]  ? x : find_set(par[x], par));
}
void union_set(ll a, ll b, vector<ll> &par) {
    a = find_set(a, par);
    b = find_set(b, par);
    if (a == b) return;
    par[b] = a;
}
bool is_prime(int n) {
    for (int i = 2; i * i <= n; i++) {
        if (n % i == 0) return false;
    }
    return true;
}
bool is_Sorted(vector<ll> &v) {
    for (int i = 1; i < v.size(); i++) {
        if (v[i - 1] > v[i]) return false;
    }
    return true;
}
bool is_Palindrome(string s) {
    int i = 0, j = s.length() - 1;
    while (i < j) {
        if (s[i++] != s[j--]) return false;
    }
    return true;
}
struct CustomCompare
{
    bool operator()(const pair<int, int>& lhs, const pair<int, int>& rhs)
    {
        if (lhs.fs == rhs.fs) return lhs.se < rhs.se;
        return lhs.fs > rhs.fs;
    }
};
ll NcR(ll n, ll r) {
    if (r > n) return 0;
    if (n - r < r) r = n - r;
    ll dp[r + 1];
    memset(dp, 0, sizeof(dp));
    dp[0] = 1;
    for (ll i = 1; i <= n; i++) {
        for (ll j = min(r, i); j > 0; j--) {
            dp[j] = (dp[j] + dp[j - 1]) % INF;
        }
    }
    return dp[r];
}
/* ----------------------------------JAI MAHAKAAL---------------------------*/
void solve() {
    ll n; cin >> n;
    ll x = 2 * n + 1;
    if (n < 4) cout << x << "\n";
    else {
        ll les = x / 4;
        les--;
        while (les > 0) {
            if ((x - 1) % 4 == 0) x--;
            else {
                if (x & 1) x -= 2;
                else x--;
            }
            les--;
        }
        cout << x << "\n";
    }
}
int main() {
//    init_code();
    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}

#include<iostream>
using namespace std;
int main(){
    int n=0,i=0,j=0;
    cin>>n;
    for(;j<n;i++){
        if(i>=3&&i%2==1){
            j++;
        }else if(i>=8&&i%4==0){
            j++;
        }
    }
    cout<<i-1;
    return 0;
}

#include <bits/stdc++.h>

#define pii pair<ll, ll>
#define sc second
#define fr first

using namespace std;

typedef long long ll;
typedef long double ld;

const ll maxAns = 1e14;
const ll maxN = 1e9+7;

int main() {
	ios::sync_with_stdio(0);
	cin.tie();
	cout.tie();
		ll n;
		cin >> n;
		if(n < 3){
			cout << n*2+1 << '\n';
		}
		else{
			n -= 3;
			ll k = n/3+7;
			cout << n+k << '\n';
		}
}

// ... l ... r ...

#include <iostream>
using namespace std;

typedef unsigned long long ull;
ull suitable(ull n)
{
    if(n==1) return 3;
    return n/3 * 4 + n%3 +3;
}
int main()
{

    ull n;
    scanf("%llu", &n);
    printf("%llu", suitable(n));
    return 0;
}

#include <bits/stdc++.h>
// #include "atcoder/all"
// using namespace atcoder;
using namespace std;
using ll = long long;
const int MOD1000000007 = 1000000007;
const int MOD998244353 = 998244353;
const double PI = 3.14159265358979323846264338327950288;

void solve()
{
    /**
     * a-b a+b
     * d 2*a-d; 2*a-d2
     **/
    int n;
    cin >> n;
    ll l = 1, r = 1e11;
    while (l < r)
    {
        int f = 0;
        ll mid = (l + r) / 2;
        ll s = 0;
        for (ll d = 1; d <= 2; d++)
        {
            ll mx = mid / d;
            ll mn = d + 2;
            if (mn > mx)
                break;
            s += (mx - mn + 2) / 2;
            if (s >= n)
            {
                f = 1;
                break;
            }
        }
        if (f)
            r = mid;
        else
            l = mid + 1;
    }
    cout << l << endl;
}

int main()
{

#ifdef LOCAL
    freopen("in.txt", "r", stdin);
#endif
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    solve();
#ifdef LOCAL
    printf("\nTime elapsed: %.2fs.\n", 1.0 * clock() / CLOCKS_PER_SEC);
#endif
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
void solve() {
    ll n; cin >> n;
    ll l = 1, r = 1000000000000;
    function<bool(ll)> check = [&] (ll mid) {
        ll x = mid / 2;
        ll y = (x + 1) / 2;
        if (mid >= 4) y += 1;
        if (mid >= 1) y += 1;
        return mid - y >= n;
    };
    while (l < r) {
        ll mid = (l + r) >> 1;
        if (check(mid)) r = mid;
        else l = mid + 1;
    }
    cout << l << "\n";
}

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    solve();
    return 0;
}

#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<utility>
#include<cctype>
#include<iomanip>
#include<set>
#include<unordered_set>
#include<map>
#include<unordered_map>
#include<algorithm>
using namespace std;
#define ll long long
#define ull unsigned long long
#define OV(x,s) for(auto y:x) cout<<y<<s;
int main(){
ull n;cin>>n;
if(n==1) {cout<<3<<endl;return 0;}
unsigned long long x=(unsigned long long)((unsigned long long)4*n-3)/3;
cout<<x+4<<endl;
}

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <string>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <cmath>
#include <set>
#include <sstream>
#include <stdio.h>
#include <string.h>
#define PI 3.14159265358979383246
#define ll long long
#define _for(a) for(int i = 0; i < (a); ++i)
#define _rep(a, b) for(size_t i = (a); i < (b); ++i)
#define  _for_each(my_vec) for(auto x:my_vec)
#define  __for_each(my_vec) for(auto &x:my_vec)
#define f float
#define my_vec(size) vector<ll>my_vec(size)
#define q1  cin.tie(0)
#define q2 cin.sync_with_stdio(0)
using namespace std;
class unary {
    int a,b;
public:
    unary(int a=0,int b=0){
        this->a=a;
        this->b=b;
    }
    bool operator <= (unary m){

        return (a!=m.a &&b!=m.b);
    }
    void shoe_data(){
        cout << a<<"  "<<b;
    }
};
int main() {
    int c, con,d,n;
    cin >> n;
    if (n == 1) {
        cout << " 3 " << endl;
    } else if (n == 2) {
        cout << " 5 " << endl;
    } else if (n == 3) {
        cout << " 7 " << endl;
    } else {
        d = n / 3;
        c = n % 3;
        con = 3 + 4 * d + c;
        cout << con << endl;
    }
}
// problems:::
//https://codeforces.com/group/T3p02rhrmb/contest/334361/my
//https://codeforces.com/problemset/problem/1725/G
//https://codeforces.com/problemset/problem/110/A
//https://codeforces.com/contest/1728/problem/C

#pragma GCC target("avx")
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>
#define between(x, l, r) (x >= l && x <= r)
#define point(a, b, m) ((a - 1) * m + b)
#define IDX(x, m) (PII) { (x - 1) / m + 1, (x - 1) % m + 1 }
#define all(x) (x).begin(), (x).end()
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define eb emplace_back
#define pb push_back
#define mk make_pair
#define y second
#define x first

using namespace std;

typedef long long LL;
typedef pair<long double, long double> PDD;
typedef pair<int, int> PII;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x;}

constexpr int N = 2e5 + 10, M = 4 * N, mod = 1e9 + 7;
constexpr LL INF = 1e18;
constexpr long double eps = 1e-9;

/*
对于所有的
b > a
比x小的 (b^2-a^2)
2x-1+
2x-3+
2x-5
<= mid

a^2 - b^2 == c^2 - d^2
2*a*

6开始就是+4+4了
*/

void solve()
{
    LL n;
    cin >> n;
    LL l = 1, r = 1e15;

    auto f = [&](LL x)
    {
        if(x < 1) return 0LL;
        if(x < 2) return 1LL;
        if(x < 4) return 2LL;
        if(x < 6) return 3LL;
        LL t = x - 6;
        return 4 + t / 4;
    };

    auto check = [&](LL mid) {
        return mid - f(mid) >= n;
    };

    while (l < r)
    {
        LL mid = l + r >> 1;
        if(check(mid)) r = mid;
        else l = mid + 1;
    }
    cout << l << '\n';
}

int main()
{
    // freopen("C:\\AKICPC\\test5.in", "r", stdin), freopen("C:\\AKICPC\\test5.out", "w", stdout);
    ios::sync_with_stdio(0), cin.tie(0);
    cout.precision(2), cout.setf(ios::fixed);
    // auto now = clock();

    int t = 1;
    // cin >> t;
    while (t--) solve();

    // cout << "Program run for " << (clock() - now) / (long double)CLOCKS_PER_SEC * 1000 << " ms." << endl;
    return 0;
}

#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N=5e4;
int a[N+5];
signed main()
{
    int n;
    while(cin>>n)
    if(n==1)
        cout<<3<<endl;
    else if(n==2)
        cout<<5<<endl;
    else
    {
        n-=2;
        int times=(n+2)/3;
        cout<<times*4+(n-1)%3+3<<endl;
    }
	return 0;
}

#include <iostream>

int main() {
    int n;
    std::cin >> n;
    if (n == 1)
        std::cout << 3;
    else {
        n -= 2;
        int base = (n/3)*4 + 5;
        if (n%3 == 1) base += 2;
        if (n%3 == 2) base += 3;
        std::cout << base;
    }
}

// Author : Dhruv Goti....
// From   : Daiict.....

#include <bits/stdc++.h>

using namespace std;
#define ll long long int
#define all(a) (a).begin(),(a).end()
#define endl '\n'

void TOS()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
}

//for string
vector<string> vec_splitter(string s) {
   s += ',';
   vector<string> res;
   while(!s.empty()) {
      res.push_back(s.substr(0, s.find(',')));
      s = s.substr(s.find(',') + 1);
   }
   return res;
}

//for variable
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx,
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
   if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
   stringstream ss; ss << H;
   cerr << args[idx] << " = " << ss.str();
   debug_out(args, idx + 1, LINE_NUM, T...);
}

// for vector set
template<typename C,
         typename T = std::decay_t<decltype(*begin(std::declval<C>()))>,
         typename std::enable_if<!std::is_same<C, std::string>::value>::type* = nullptr
         >
std::ostream &operator<<(std::ostream &os, const C &container){
  bool first = true;
  std::stringstream ss;
  ss << '[';
  for(const auto &x : container){
    if (!first){
      ss << ", ";
    }
    first = false;
    ss << x;
  }
  ss << ']';
  return os << ss.str();
}

// for map
template<class T1, class T2>
std::ostream &operator<<(std::ostream &os, const std::pair<T1,T2> &p){
  os << '{' << p.first << ", " << p.second << '}';
  return os;
}

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int getRand(int l, int r)
{
   uniform_int_distribution<int> uid(l, r);
   return uid(rng);
}

#define DXOX
#ifdef DXOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

void solve()
{
   ll n;
   cin>>n;
   if(n==1) { cout<<3<<endl; return; }
   if(n==2) { cout<<5<<endl; return; }
   ll d=((n/3)+1)*4;
   if(n%3==0) cout<<d-1<<endl;
   else if(n%3==1) cout<<d<<endl;
   else cout<<d+1<<endl;

}

int main()
{
    TOS();
    ll qq_itr=1;
    // cin >> qq_itr;
    while (qq_itr--)
        solve();
}

#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <stack>
#include <set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <unordered_set>
#define forn(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
int main()
{
    int n;
    cin >> n;
    if (n == 1)
    {
        cout << 3 << '\n';
        return 0;
    }
    else if (n==2)
    {
        cout << 5 << '\n';
        return 0;
    }
    int temp = 6+(((n-2)/3)*4)+((n-2)%3);
    if ((n-2)%3 == 0)
        cout << temp-1 << endl;
    else cout << temp << endl;
}

// Solution by Saeed Keshavarzi

#define _CRT_SECURE_NO_WARNINGS

#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <ctime>
#include <bitset>
#define _USE_MATH_DEFINES
#include <cmath>
#include <random>
#include <string>
#include <vector>
#include <cctype>
#include <cstdlib>
#include <sstream>
#include <cassert>
#include <utility>
#include <complex>
#include <cstdio>
#include <memory.h>
#include <iomanip>
#include <iostream>
#include <algorithm>

#ifdef LOCAL
#include <conio.h>
#define ini()    (void)freopen("input.txt", "rt", stdin); \
                    std::ios::sync_with_stdio(false); \
                    std::cin.tie(NULL); \
                    std::cout << std::fixed << std::setprecision(6); \
                    std::cerr << std::fixed << std::setprecision(6)

#define ret()    { char ch; while (std::cin.readsome(&ch, 1) != 0); } (void)_getch(); return 0
#else
#define ini()    std::ios::sync_with_stdio(false); \
                    std::cin.tie(NULL); \
                    std::cout << std::fixed << std::setprecision(11); \
                    std::cerr << std::fixed << std::setprecision(6)

#define ret()    return 0
#endif

#define For(i, n)        for( int (i) = 0; (i) < (n); ++(i) )
#define Forn(i, a, b)    for( int (i) = (a); (i) < (b); ++(i) )
#define SET(t, v)        memset((t), (v), sizeof(t))

//      signed int                    // -2e9  to 2e9   // (-2147483648)          - (2147483647)           // %d
typedef unsigned int        uint;     // 0     to 4e9   // (0)                    - (4294967295)           // %u
typedef signed long long    int64;    // -9e18 to 9e18  // (-9223372036854775808) - (9223372036854775807)  // %I64d
typedef unsigned long long  uint64;   // 0     to 18e18 // (0)                    - (18446744073709551615) // %I64u

// local variables
int n, rem;

int main()
{
    ini();

    (void)scanf("%d", &n);
    rem = (n + 2) % 3;
    if (n == 1)
        printf("3");
    else if (rem == 0)
        printf("%d", (n + 2) / 3 * 4);
    else if (rem == 1)
        printf("%d", (n + 2) / 3 * 4 + 1);
    else if (rem == 2)
        printf("%d", (n + 2) / 3 * 4 + 3);

    ret();
}

// Author : Dhruv Goti....
// From   : Daiict.....

#include <bits/stdc++.h>

using namespace std;
#define ll long long int
#define all(a) (a).begin(),(a).end()
#define endl '\n'

void TOS()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
}

//for string
vector<string> vec_splitter(string s) {
   s += ',';
   vector<string> res;
   while(!s.empty()) {
      res.push_back(s.substr(0, s.find(',')));
      s = s.substr(s.find(',') + 1);
   }
   return res;
}

//for variable
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx,
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
   if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
   stringstream ss; ss << H;
   cerr << args[idx] << " = " << ss.str();
   debug_out(args, idx + 1, LINE_NUM, T...);
}

// for vector set
template<typename C,
         typename T = std::decay_t<decltype(*begin(std::declval<C>()))>,
         typename std::enable_if<!std::is_same<C, std::string>::value>::type* = nullptr
         >
std::ostream &operator<<(std::ostream &os, const C &container){
  bool first = true;
  std::stringstream ss;
  ss << '[';
  for(const auto &x : container){
    if (!first){
      ss << ", ";
    }
    first = false;
    ss << x;
  }
  ss << ']';
  return os << ss.str();
}

// for map
template<class T1, class T2>
std::ostream &operator<<(std::ostream &os, const std::pair<T1,T2> &p){
  os << '{' << p.first << ", " << p.second << '}';
  return os;
}

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int getRand(int l, int r)
{
   uniform_int_distribution<int> uid(l, r);
   return uid(rng);
}

#define DXOX
#ifdef DXOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

void solve()
{
   int n;
   cin>>n;
   if(n==1) {cout<<3<<endl; return;}
    if(n==2) {cout<<5<<endl; return;}

      int ok=7;
      for(int x=4;x<=n;++x)
      {
         if(x%3==0) ok+=2;
         else ok++;
      }
      cout<<ok<<endl;

}

int main()
{
    TOS();
    ll qq_itr=1;
    // cin >> qq_itr;
    while (qq_itr--)
        solve();
}

#include <iostream>
#include <bits/stdc++.h>
#include <string>
using namespace std;
#define int long long
const double MAX = 2e5 + 2;
int n, k;
string s;

void solve()
{
  cin >> n ;
  // int st=1,
  if(n==1)
  cout<<3<<endl;
  else
  cout<< (4*n+9)/3<<endl;
}
void fimo();
signed main()
{
  fimo();
  solve();
  // int t;
  // cin >> t;

  // while (t--)
  // {
  //   solve();
  // }
// cout<<(int)'1'<<endl;
#ifndef ONLINE_JUDGE
  cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
#endif
  return 0;
}
void fimo()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}

#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <map>
#include <unordered_map>
#include <queue>
#include <vector>
#include <set>
#include <stack>
#include <string>
#include <random>
#include <fstream>
using namespace std;

#define PI acos(-1.0)
#define EPS 1e-8
#define endl '\n'

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef pair<long long, int> PLI;
typedef pair<string, string> PSS;

const int inf = 0x3f3f3f3f;
const int N = 2e5 + 5;
const int mod = 998244353;

int n;

void solve() {
    cin >> n;
    if (n == 1) cout << 3;
    else if (n == 2) cout << 5;
    else{
        n -= 3;
        cout << n / 3 * 4 + n % 3 + 7;
    }
}

int main()
{
    std::ios::sync_with_stdio(0);
    int t = 1;
    //cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll ;
const int maxn = 1e7 + 7 ;
inline ll read(){
	ll x = 0 , f = 1 ;
	char c = getchar() ;
	while(c > '9' || c < '0'){
		if(c == '-')
			f = -1 ;
		c = getchar() ;
	}
	while(c >= '0' && c <= '9'){
		x = x * 10 + c - '0' ;
		c = getchar() ;
	}
	return x * f ;
}
ll n ;
int main(){
	n = read() ;
	if(n == 1){
		printf("3\n") ;
		return 0 ;
 	}
	ll ans = n - 1 ;
	if(ans % 3 == 0){
		printf("%lld\n" , ans / 3 * 4 + 4) ;
	}
	else{
		ans -= ans / 3 ;
		printf("%lld\n" , 3 + ans * 2 ) ;
	}
	return 0 ;
}

#include <bits/stdc++.h>
using namespace std;

#define mk(x, y) make_pair(x, y)
#define iloop(n) for (int i = 0; i < n; i++)
#define jloop(n) for (int j = 0; j < n; j++)
#define vin(v, n) \
    iloop(n) { cin >> v[i]; }
#define endl '\n'
#define all(x) (x).begin(), (x).end()

#define print(x)                             \
    {                                        \
        iloop(x.size()) cout << x[i] << ' '; \
        cout << endl;                        \
    }
#define debug(v)             \
    {                        \
        cout << #v << " : "; \
        print(v)             \
    }
typedef long long int ll;
typedef vector<vector<int>> vvi;
typedef vector<int> vi;
typedef vector<bool> vb;

const int SHIFTS[4][2] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}};
const int rem = 1e9 + 7;

void init_io()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
}

string get_min(string &curr, int k)
{
    string t = curr;
    while (t.size() < k)
    {
        t += t;
    }
    return t.substr(0, k);
}

void solve()
{

    int n;
    cin >> n;
    ll l = 3, r = 1e15;
    while (l <= r)
    {
        ll mid = (l + r) >> 1;
        ll idx = (mid - 2) / 4 + 1;
        ll covered = mid - idx - 1;
        if (mid >= 4)
        {
            covered--;
        }
        if (covered >= n)
        {
            r = mid - 1;
        }
        else
        {
            l = mid + 1;
        }
    }
    cout << l;
}

int main()
{
    init_io();
    int t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
        cout << endl;
    }
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

void xuly(){
    ll n; cin>>n;
    if(n==1){
        cout<<3<<endl;
    }
    else cout<<(4*n)/3+3<<endl;
}

int main(){
    xuly();
}

#include <bits/stdc++.h>

#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#pragma GCC optimize("Ofast")//Comment optimisations for interactive problems (use endl)
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

using namespace std;

struct PairHash {inline std::size_t operator()(const std::pair<int, int> &v) const { return v.first * 31 + v.second; }};

// speed
#define Code ios_base::sync_with_stdio(false);
#define By ios::sync_with_stdio(0);
#define Sumfi cout.tie(NULL);

// alias
using ll = long long;
using ld = long double;
using ull = unsigned long long;

// constants
const ld PI = 3.14159265358979323846;  /* pi */
const ll INF = 1e18;
const ld EPS = 1e-9;
const ll MAX_N = 101010;
const ll mod = 998244353;

// typedef
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef array<ll,3> all3;
typedef array<ll,5> all5;
typedef vector<all3> vall3;
typedef vector<all5> vall5;
typedef vector<ld> vld;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int> vi;
typedef pair<string, string> pss;
typedef vector<pss> vpss;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef unordered_set<ll> usll;
typedef unordered_set<pll, PairHash> uspll;
typedef unordered_map<ll, ll> umll;
typedef unordered_map<pll, ll, PairHash> umpll;

// macros
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,m,n) for(ll i=n;i>=m;i--)
#define all(a) begin(a), end(a)
#define rall(a) rbegin(a), rend(a)
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define ASCEND(a) iota(all(a),0)
#define sz(x) ll((x).size())
#define pyes cout<<"Yes\n";
#define pno cout<<"No\n";
#define pneg1 cout<<"-1\n";
#define ppossible cout<<"Possible\n";
#define pimpossible cout<<"Impossible\n";
#define CASE(x) cout<<"Case #"<<x<<": ";

// utility functions
template <typename T>
void print(T &&t)  { cout << t << "\n"; }
template<typename T>
void printv(vector<T>v){ll n=v.size();rep(i,0,n)cout<<v[i]<<" ";cout<<"\n";}
void fileIO() {freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);}
void hackerCupIO() {freopen("/Users/summerflower/Downloads/second_flight_input.txt", "r", stdin); freopen("/Users/summerflower/Downloads/solution.txt","w",stdout);}
void readf() {freopen("", "rt", stdin);}
template<typename T>
void readv(vector<T>& v){rep(i,0,sz(v)) cin>>v[i];}
template<typename T, typename U>
void readp(pair<T,U>& A) {cin>>A.first>>A.second;}
template<typename T, typename U>
void readvp(vector<pair<T,U>>& A) {rep(i,0,sz(A)) readp(A[i]); }
void readvall3(vall3& A) {rep(i,0,sz(A)) cin>>A[i][0]>>A[i][1]>>A[i][2];}
void readvvll(vvll& A) {rep(i,0,sz(A)) readv(A[i]);}

// geometry data structures
template <typename T>
struct Point {
    T y,x;
    Point() {}
    void input() {cin>>y>>x;}
};

template<typename T>
struct Circle {
    Point<T> center;
    T radius;
    Circle() {}

    void input() {
        center = Point<T>();
        center.input();
        cin>>radius;
    }

    bool circumference(Point<T> p) {
        return (center.x - p.x) * (center.x - p.x) + (center.y - p.y) * (center.y - p.y) == radius * radius;
    }

    bool intersect(Circle<T> c) {
        T d = (center.x - c.center.x) * (center.x - c.center.x) + (center.y - c.center.y) * (center.y - c.center.y);
        return (radius - c.radius) * (radius - c.radius) <= d and d <= (radius + c.radius) * (radius + c.radius);
    }
};

ll __gcd(ll x, ll y) { return !y ? x : __gcd(y, x % y); }
ll __lcm(ll x, ll y) { return x / __gcd(x,y) * y; }
ll modpow(ll n, ll x, ll MOD = mod) { if(!x) return 1; ll res = modpow(n,x>>1,MOD); res = (res * res) % MOD; if(x&1) res = (res * n) % MOD; return res; }

ll solve(ll n) {
    return n == 1 ? 3 : 3 + 4 * (n / 3) + n % 3;
}

int main() {
    Code By Sumfi
    cout.precision(12);
    ll tc = 1;
    //cin>>tc;
    rep(i,1,tc+1) {
        ll n;
        cin>>n;
        print(solve(n));
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n;cin>>n;
    cout<<int(4+floor((4*n-3)/3));
}

/**
 * "Fate is a lie, told by the Gods." - God of War
 *
 *  Dated: Tue, 13 Sep 2022 17:34:55 +0530
 */

#include <bits/stdc++.h>
using namespace std;

template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string &s) { return '"' + s + '"'; }

string to_string(const char *s) { return to_string((string)s); }

string to_string(bool b) { return (b ? "true" : "false"); }

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " +
         to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " +
         to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define dbg(...)
#endif

#define ll long long
#define rep(a, b, i) for (ll i = a; i < b; i++)
#define repi(a, b, i) for (ll i = a; i >= b; i--)

constexpr int MOD = (int)1e9 + 7;
constexpr int mxn = (int)1e5 + 1;

signed main() {
#ifndef LOCAL
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
#endif

  int n; cin >> n;

  int l = 1, r = (int)1e9 + 1;
  while (r - l > 1) {
    int mid = l + (r - l) / 2;
    int x = mid / 4 + (mid + 1) / 2 - 2;

    if (x > n) {
      r = mid;
    }
    else if (x < n) {
      l = mid + 1;
    }
    else if (x == n) {
      if(!(mid & 1) && !(mid % 4 == 0)) {
        l = mid - 1;
        break;
      } else {
        l = mid;
      }
    }
  }

  cout << l << '\n';

  return 0;
}

#include<bits/stdc++.h>

using namespace std;

long long fun(long long num)
{
	//need to check how many of them are invalid nos. <=num;
	//then print valid <=num;

	long long valid = num / 2;
	valid--; //bcz 1 is not valid

	if (num % 2 == 1)
		valid++;

	//now under validity variable we have no. of total valid odd nos. now lets count even
	valid += num / 4;
	valid--; //bcz 4 itself is not valid

	return valid;
}

int main()
{
	int n;
	cin >> n;

	long long lo = 3;
	long long hi = 1e18;

	while (hi > lo)
	{
		long long mid = (lo + hi) / 2;
		long long x = fun(mid);
		//cout << mid << endl;
		if (x > n)
		{
			hi = mid - 1;
		}
		else if (x == n)
		{
			cout << mid;
			return 0;
		}
		else
			lo = mid + 1;
	}

	return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	if (m == 1) {
		cout << n - 1 << '\n';
		return 0;
	}
	else cout << (long long)n * (m - 1) << '\n';
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main(){
    int N; cin >> N;
    if (N % 3 == 1){
        if (N == 4) cout << N * 2 << endl;
        else cout << N + 4 + (N-1)/3 -1 << endl;
    }
    else{
        if (N <= 3) cout << N * 2 + 1 << endl;
        else cout << N * 2 - (((N-1)/3)*2)-1 << endl;
    }
}

#include <iostream>
#include <bits/stdc++.h>
// #include <sys/resource.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace chrono;
// using namespace __gnu_pbds;

//def
// #define AbhinavAwasthi 1

//Speed
#define Code ios_base::sync_with_stdio(false);
#define By cin.tie(NULL);
#define Asquare cout.tie(NULL);

//Aliases
using ll= long long;
using lld= long double;
using ull= unsigned long long;

//Constants
const lld pi= 3.141592653589793238;
const ll INF= 1e18;
const ll mod=1e9+7;

//TypeDEf
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef unordered_map<ll,ll> umll;
typedef map<ll,ll> mll;

// Macros
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define fl(i,n) for(int i=0;i<n;i++)
#define rl(i,m,n) for(int i=n;i>=m;i--)
#define py cout<<"YES\n";
#define pm cout<<"-1\n";
#define pn cout<<"NO\n";
#define vr(v) v.begin(),v.end()
#define rv(v) v.end(),v.begin()
#define nl '\n'

//Debug
#ifdef AbhinavAwasthi
#define debug(x) cerr << #x<<" "; cerr<<x<<" "; cerr << endl;
#else
#define debug(x);
#endif

// Operator overloads
template<typename T1, typename T2> // cin >> pair<T1, T2>
istream& operator>>(istream &istream, pair<T1, T2> &p) { return (istream >> p.first >> p.second); }
template<typename T> // cin >> vector<T>
istream& operator>>(istream &istream, vector<T> &v){for (auto &it : v)cin >> it;return istream;}
template<typename T1, typename T2> // cout << pair<T1, T2>
ostream& operator<<(ostream &ostream, const pair<T1, T2> &p) { return (ostream << p.first << " " << p.second<<"\n"); }
template<typename T> // cout << vector<T>
ostream& operator<<(ostream &ostream, const vector<T> &c) { for (auto &it : c) cout << it << " "; return ostream; }

// Utility functions
template <typename T>
void print(T &&t)  { cout << t << "\n"; }
void printarr(ll arr[], ll n){fl(i,n) cout << arr[i] << " ";cout << "\n";}
template<typename T>
void printvec(vector<T>v){ll n=v.size();fl(i,n)cout<<v[i]<<" ";cout<<"\n";}
template<typename T>
ll sumvec(vector<T>v){ll n=v.size();ll s=0;fl(i,n)s+=v[i];return s;}

// Mathematical functions
ll gcd(ll a, ll b){if (b == 0)return a;return gcd(b, a % b);}
ll lcm(ll a, ll b){return (a/gcd(a,b)*b);}
ll moduloMultiplication(ll a,ll b,ll mod){ll res = 0;a %= mod;while (b){if (b & 1)res = (res + a) % mod;b >>= 1;}return res;}
ll powermod(ll x, ll y, ll p){ll res = 1;x = x % p;if (x == 0) return 0;while (y > 0){if (y & 1)res = (res*x) % p;y = y>>1;x = (x*x) % p;}return res;}

//Graph-dfs
// bool gone[MN];
// vector<int> adj[MN];
// void dfs(int loc){
//     gone[loc]=true;
//     for(auto x:adj[loc])if(!gone[x])dfs(x);
// }

//To Remember
// vector<array<int, 2>> ranges(n);
//     cin >> ranges;

//     sort(all(ranges), [] (const array<int, 2>& X, const array<int, 2>& Y){
//         return X[1] - X[0] < Y[1] - Y[0];
//     });

//Sorting
bool sorta(const pair<int,int> &a,const pair<int,int> &b){return (a.second < b.second);}
bool sortd(const pair<int,int> &a,const pair<int,int> &b){return (a.second > b.second);}

//Bits
string decToBinary(int n){string s="";int i = 0;while (n > 0) {s =to_string(n % 2)+s;n = n / 2;i++;}return s;}
ll binaryToDecimal(string n){string num = n;ll dec_value = 0;int base = 1;int len = num.length();for(int i = len - 1; i >= 0; i--){if (num[i] == '1')dec_value += base;base = base * 2;}return dec_value;}

//Check
bool isPrime(ll n){if(n<=1)return false;if(n<=3)return true;if(n%2==0||n%3==0)return false;for(int i=5;i*i<=n;i=i+6)if(n%i==0||n%(i+2)==0)return false;return true;}
bool isPowerOfTwo(int n){if(n==0)return false;return (ceil(log2(n)) == floor(log2(n)));}
bool isPerfectSquare(ll x){if (x >= 0) {ll sr = sqrt(x);return (sr * sr == x);}return false;}

 void asquare()
 {
   ll n;
   cin>>n;
   ll ans=floor( (4*n)/3) +3;
   if(n==1)cout<<"1"<<endl;
   else cout<< ans<<endl;
 }
//Main
int main()
{

        asquare();

    // asquare();
    return 0;
}

#include <bits/stdc++.h>
#include <list>
#define endl '\n'
#define  int long long
#define PI acos(-1)
#define INF 2e18
double rotatex(double x,double y,double ang){ang=ang*PI/180;return x*cos(ang)-y*sin(ang);}
double rotatey(double x,double y,double ang){ang=ang*PI/180;return x*sin(ang)+y*cos(ang);}
using namespace std;
vector<double>v;
double a[100005];
signed main(){
    int n;cin >> n;
    if(n==6) {
        cout << 11 << endl;
        exit(0);
    }
    if(n==5){
        cout << 9 << endl;
        exit(0);
    }
    cout << n+n+1 << endl;
    return 0;
}
//3 15 18 63 90

// #pragma comment(linker, "/STACK:102400000,102400000")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("O2")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
//#pragma GCC optimize("trapv")
//#pragma GCC optimize(3,"Ofast","inline")
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<ctime>
#include<bitset>
#include<unordered_map>
#include<unordered_set>
using namespace std;
using in = __int128;

#define ios std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define INF 0x3f3f3f3f3f3f3f3fll
#define inf 0x3f3f3f3f
#define lowbit(x) x & -x
#define sqr(x) ((x) * (x))
#define pb push_back
#define se second
#define fi first
#define endl '\n'
#define vi vector<int>
#define vl vector<long long>
#define vii vector<pair<int, int>>
#define all(x) (x).begin(), (x).end()
#define D(x) cout << "BUG:  " << (x) << '\n'
#define DD(x, y) cout << "BUG:  " << (x) << "  " << (y) << '\n'
#define int long long
const int M = 1e5 + 10, N = 1e6 + 10, mod = 1e9 + 7;

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
template <typename T> void inline re(T &x) {
    int f = 1; x = 0; char s = getchar();
    while (s < '0' || s > '9') { if (s == '-') f = -1; s = getchar(); }
    while (s <= '9' && s >= '0') x = x * 10 + (s ^ 48), s = getchar();
    x *= f;
}
template <typename T> void inline pr(T x) {
    if (x < 0) { putchar('-'); pr(-x); return ; }
    if (x >= 10) pr(x / 10);
    putchar((x % 10) + '0');
}

ll qpow(ll a,ll b){ll ans=1;while(b){if(b&1)ans=ans*a%mod;a=a*a%mod;b>>=1;}return ans;}
ll qpow(ll a,ll b,ll p){ll ans=1;while(b){if(b&1)ans=ans*a%p;a=a*a%p;b>>=1;}return ans;}
ll inv(ll x){return qpow(x,mod-2);}

//----------------------------------------------------------------------------------------//
int a[1000000+10]=
{813333336,26666669,40000003,53333336,66666669,80000003,93333336,106666669,120000003,133333336,
146666669,160000003,173333336,186666669,200000003,213333336,226666669,240000003,253333336,266666669,
280000003,293333336,306666669,320000003,333333336,346666669,360000003,373333336,386666669,400000003,
413333336,426666669,440000003,453333336,466666669,480000003,493333336,506666669,520000003,533333336,
546666669,560000003,573333336,586666669,600000003,613333336,626666669,640000003,653333336,666666669,
680000003,693333336,706666669,720000003,733333336,746666669,760000003,773333336,786666669,800000003,
813333336,826666669,840000003,853333336,866666669,880000003,893333336,906666669,920000003,933333336,
946666669,960000003,973333336,986666669,1000000003,1013333336,1026666669,1040000003,1053333336,1066666669,
1080000003,1093333336,1106666669,1120000003,1133333336,1146666669,1160000003,1173333336,1186666669,1200000003,
1213333336,1226666669,1240000003,1253333336,1266666669,1280000003,1293333336,1306666669,1320000003,1333333336,
1346666669,1360000003,1373333336,1386666669,1400000003,1413333336,1426666669,1440000003,1453333336,1466666669,
1480000003,1493333336,1506666669,1520000003,1533333336,1546666669,1560000003,1573333336,1586666669,1600000003,
1613333336,1626666669,1640000003,1653333336,1666666669,1680000003,1693333336,1706666669,1720000003,1733333336,
1746666669,1760000003,1773333336,1786666669,1800000003,1813333336,1826666669,1840000003,1853333336,1866666669,
1880000003,1893333336,1906666669,1920000003,1933333336,1946666669,1960000003,1973333336,1986666669,2000000003,
2013333336,2026666669,2040000003,2053333336,2066666669,2080000003,2093333336,2106666669,2120000003,2133333336,
2146666669,2160000003,2173333336,2186666669,2200000003,2213333336,2226666669,2240000003,2253333336,2266666669,
2280000003,2293333336,2306666669,2320000003,2333333336,2346666669,2360000003,2373333336,2386666669,2400000003,
2413333336,2426666669,2440000003,2453333336,2466666669,2480000003,2493333336,2506666669,2520000003,2533333336,
2546666669,2560000003,2573333336,2586666669,2600000003,2613333336,2626666669,2640000003,2653333336,2666666669,
2680000003,2693333336,2706666669,2720000003,2733333336,2746666669,2760000003,2773333336,2786666669,2800000003,
2813333336,2826666669,2840000003,2853333336,2866666669,2880000003,2893333336,2906666669,2920000003,2933333336,
2946666669,2960000003,2973333336,2986666669,3000000003,3013333336,3026666669,3040000003,3053333336,3066666669,
3080000003,3093333336,3106666669,3120000003,3133333336,3146666669,3160000003,3173333336,3186666669,3200000003,
3213333336,3226666669,3240000003,3253333336,3266666669,3280000003,3293333336,3306666669,3320000003,3333333336,
3346666669,3360000003,3373333336,3386666669,3400000003,3413333336,3426666669,3440000003,3453333336,3466666669,
3480000003,3493333336,3506666669,3520000003,3533333336,3546666669,3560000003,3573333336,3586666669,3600000003,
3613333336,3626666669,3640000003,3653333336,3666666669,3680000003,3693333336,3706666669,3720000003,3733333336,
3746666669,3760000003,3773333336,3786666669,3800000003,3813333336,3826666669,3840000003,3853333336,3866666669,
3880000003,3893333336,3906666669,3920000003,3933333336,3946666669,3960000003,3973333336,3986666669,4000000003,
4013333336,4026666669,4040000003,4053333336,4066666669,4080000003,4093333336,4106666669,4120000003,4133333336,
4146666669,4160000003,4173333336,4186666669,4200000003,4213333336,4226666669,4240000003,4253333336,4266666669,
4280000003,4293333336,4306666669,4320000003,4333333336,4346666669,4360000003,4373333336,4386666669,4400000003,
4413333336,4426666669,4440000003,4453333336,4466666669,4480000003,4493333336,4506666669,4520000003,4533333336,
4546666669,4560000003,4573333336,4586666669,4600000003,4613333336,4626666669,4640000003,4653333336,4666666669,
4680000003,4693333336,4706666669,4720000003,4733333336,4746666669,4760000003,4773333336,4786666669,4800000003,
4813333336,4826666669,4840000003,4853333336,4866666669,4880000003,4893333336,4906666669,4920000003,4933333336,
4946666669,4960000003,4973333336,4986666669,5000000003,5013333336,5026666669,5040000003,5053333336,5066666669,
5080000003,5093333336,5106666669,5120000003,5133333336,5146666669,5160000003,5173333336,5186666669,5200000003,
5213333336,5226666669,5240000003,5253333336,5266666669,5280000003,5293333336,5306666669,5320000003,5333333336,
5346666669,5360000003,5373333336,5386666669,5400000003,5413333336,5426666669,5440000003,5453333336,5466666669,
5480000003,5493333336,5506666669,5520000003,5533333336,5546666669,5560000003,5573333336,5586666669,5600000003,
5613333336,5626666669,5640000003,5653333336,5666666669,5680000003,5693333336,5706666669,5720000003,5733333336,
5746666669,5760000003,5773333336,5786666669,5800000003,5813333336,5826666669,5840000003,5853333336,5866666669,
5880000003,5893333336,5906666669,5920000003,5933333336,5946666669,5960000003,5973333336,5986666669,6000000003,
6013333336,6026666669,6040000003,6053333336,6066666669,6080000003,6093333336,6106666669,6120000003,6133333336,
6146666669,6160000003,6173333336,6186666669,6200000003,6213333336,6226666669,6240000003,6253333336,6266666669,
6280000003,6293333336,6306666669,6320000003,6333333336,6346666669,6360000003,6373333336,6386666669,6400000003,
6413333336,6426666669,6440000003,6453333336,6466666669,6480000003,6493333336,6506666669,6520000003,6533333336,
6546666669,6560000003,6573333336,6586666669,6600000003,6613333336,6626666669,6640000003,6653333336,6666666669,
6680000003,6693333336,6706666669,6720000003,6733333336,6746666669,6760000003,6773333336,6786666669,6800000003,
6813333336,6826666669,6840000003,6853333336,6866666669,6880000003,6893333336,6906666669,6920000003,6933333336,
6946666669,6960000003,6973333336,6986666669,7000000003,7013333336,7026666669,7040000003,7053333336,7066666669,
7080000003,7093333336,7106666669,7120000003,7133333336,7146666669,7160000003,7173333336,7186666669,7200000003,
7213333336,7226666669,7240000003,7253333336,7266666669,7280000003,7293333336,7306666669,7320000003,7333333336,
7346666669,7360000003,7373333336,7386666669,7400000003,7413333336,7426666669,7440000003,7453333336,7466666669,
7480000003,7493333336,7506666669,7520000003,7533333336,7546666669,7560000003,7573333336,7586666669,7600000003,
7613333336,7626666669,7640000003,7653333336,7666666669,7680000003,7693333336,7706666669,7720000003,7733333336,
7746666669,7760000003,7773333336,7786666669,7800000003,7813333336,7826666669,7840000003,7853333336,7866666669,
7880000003,7893333336,7906666669,7920000003,7933333336,7946666669,7960000003,7973333336,7986666669,8000000003,
8013333336,8026666669,8040000003,8053333336,8066666669,8080000003,8093333336,8106666669,8120000003,8133333336,
8146666669,8160000003,8173333336,8186666669,8200000003,8213333336,8226666669,8240000003,8253333336,8266666669,
8280000003,8293333336,8306666669,8320000003,8333333336,8346666669,8360000003,8373333336,8386666669,8400000003,
8413333336,8426666669,8440000003,8453333336,8466666669,8480000003,8493333336,8506666669,8520000003,8533333336,
8546666669,8560000003,8573333336,8586666669,8600000003,8613333336,8626666669,8640000003,8653333336,8666666669,
8680000003,8693333336,8706666669,8720000003,8733333336,8746666669,8760000003,8773333336,8786666669,8800000003,
8813333336,8826666669,8840000003,8853333336,8866666669,8880000003,8893333336,8906666669,8920000003,8933333336,
8946666669,8960000003,8973333336,8986666669,9000000003,9013333336,9026666669,9040000003,9053333336,9066666669,
9080000003,9093333336,9106666669,9120000003,9133333336,9146666669,9160000003,9173333336,9186666669,9200000003,
9213333336,9226666669,9240000003,9253333336,9266666669,9280000003,9293333336,9306666669,9320000003,9333333336,
9346666669,9360000003,9373333336,9386666669,9400000003,9413333336,9426666669,9440000003,9453333336,9466666669,
9480000003,9493333336,9506666669,9520000003,9533333336,9546666669,9560000003,9573333336,9586666669,9600000003,
9613333336,9626666669,9640000003,9653333336,9666666669,9680000003,9693333336,9706666669,9720000003,9733333336,
9746666669,9760000003,9773333336,9786666669,9800000003,9813333336,9826666669,9840000003,9853333336,9866666669,
9880000003,9893333336,9906666669,9920000003,9933333336,9946666669,9960000003,9973333336,9986666669
};
void solve()
{//ios;
int T=1;
//re(T);
while(T--)
{  ll n;
   re(n);

 int pos=n/10000000;

  if(pos==0)
  {int cnt=3,x=7;
    if(n==1)cout<<3;
 else if(n==2)cout<<5;
 else if(n==3)cout<<7;
 else
 {
while(cnt<n)
  { x++;
   if(x%2==1||(x%4==0)){cnt++;}

  }
 cout<<x;

 }
  }

else{

  int cnt=pos*10000000,x=a[pos];
 while(cnt<n)
  {x++;
   if(x%2==1||(x%4==0)){cnt++;}

  }
  cout<<x;

}

}

}
signed main()
{
#ifdef  ran
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
//ios;
 //int size(512<<20);  // 512M
    //__asm__ ( "movq %0, %%rsp\n"::"r"((char*)malloc(size)+size));
    // YOUR CODE

 solve();

//exit(0);
}

#include <bits/stdc++.h>
using namespace std;
#define fo(i, n) for (i = 0; i < n; i++)
#define Fo(i, k, n) for (i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define ll long long
#define nl '\n'
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define PI 3.1415926535897932384626
#define MOD 1000000007
#define pii pair<int, int>
#define pll pair<long, long>
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vi>
#define mii map<int, int>
#define mll map<ll, ll>
#define sll set<ll>
#define pb push_back
#define F first
#define S second
ll gcd(ll a, ll b)
{
    return b == 0 ? a : gcd(b, a % b);
}
void solve()
{
    ll n;
    cin >> n;
    if (n == 1)
    {
        cout << 3 << nl;
        return;
    }
    n = n + 2;
    ll temp = 0, curr = n;
    while (temp != curr)
    {
        temp = curr;
        ll a = (curr + 2) / 4;
        curr = n + a;
    }
    cout << curr << nl;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    cin >> t;
    while (t--)
    {
        solve();
    }

    return 0;
}

// #include <bits/stdc++.h>
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<vector>
#include<vector>
#include<string>
#include<cstring>
#include<algorithm>
#include<stack>
#include<unordered_set>
#include<cmath>
#include<numeric>
#include<iterator>
#include<set>
#include<unordered_map>
#include<map>
#include<queue>
#include<cstring>
#include<stdio.h>
#include<fstream>
#include<iomanip>
#include<functional>
#include<bitset>
#include<chrono>
#include<climits>
#include<assert.h>
// #define int double
#define endl "\n"
#define ff first
#define ss second
#define ll long long int
#define db double
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vector<int>>
#define vvll vector<vector<ll>>
#define vb vector<bool>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define rep(i,n) for(ll i=0;i<n;i++)
#define rept(i,x,n) for(ll i=x;i<n;i++)
#define pb push_back
#define rev(i,a,b) for(ll i=a;i>=b;i--)
#define all(v) v.begin(),v.end()
#define tc ll tes;cin>>tes;while(tes--)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
#define coutv(v) for(auto it: (v))cout<<it<<" ";cout<<endl;
#define cout2d(v) for(auto it: (v)) {for(auto j:it) cout<<j<<" ";cout<<endl;}
#define cinv(v,n) rep(i,n){cin>>v[i];}
#define pr(s) cout<<s<<endl;

using namespace std;

#ifndef ONLINE_JUDGE
#define debug(x) cout<<#x<<" is "<<x<<endl;
#define debugv(v) cout<<#v<< " is :-"<<endl;for(auto it: (v))cout<<it<<" ";cout<<endl;
#define debug2d(v) cout<<#v<< " is :-"<<endl;cn=0;for(auto it: (v)) {cout<<cn<<" => ";cn++; for(auto j:it) cout<<j<<" ";cout<<endl;}
#define pline(x) cout<<x<<" line is reached"<<endl;
#define debugvp(v) cout<<#v<<" is :-"<<endl;for(auto i: v){cout<<"("<<i.ff<<","<<i.ss<<")"<<" ";}cout<<endl;
#define prline cout<<endl;
#define debugpair(p) cout<<#p<<" is ("<<p.ff<<","<<p.ss<<")"<<endl;
#define print(s) cout<<s<<endl;
#else
#define debug(x)
#define debugv(v)
#define debug2d(v)
#define pline(x)
#define debugvp(v)
#define prline
#define debugpair(p)
#define print(s)
#endif
ll cn;

int main() {
    ll n;
    cin>>n;
    if(n<=3){
        cout<<(2*n+1)<<"\n";
    }else{
        if((n-1)%3==0){
            cout<<2*((n-1)/3)<<"\n";
        }else{
            int x=(n-1)%3;
            int y=(n-1)/3;
            y*=2;
            y++;
            if(x==1){
                cout<<2*(y)+3<<"\n";
            }else if(x==2){
                cout<<2*(y)+5<<"\n";
            }
        }
    }

    return 0;

}

#include <bits/stdc++.h>
using namespace std;

int main(){
	int n;
	int a,b;
	int arr[100001];
		a=1;
		b=2;
	for(int i=0;i<100000;i++){

		arr[i]=b*b-a*a;
		a++;
		b++;
	}
	cin >> n;
	cout << arr[2];
	return 0;
}

#include <iostream>
#include <bits/stdc++.h>
#define Kirlos ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define ll long long
#define pb(k) push_back(k)
#define endl '\n'
#define mp(x,y) make_pair(x,y)
#define MOD 1000000007;
using namespace std;

int main()
{
    Kirlos
    ll t;
    t=1;
    //cin>>t;
    while(t--)
    {
        ll n;
        cin>>n;
        cout<<pow(sqrt(7)*n/3,2)<<endl;
    }
}

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int>PII;
#define endl '\n'
#define io ios::sync_with_stdio(false),cin.tie(0)
const int INF = 0x3f3f3f3f;

int n,m,k,T;

void solve(){
    cin >> n;
    cout << 2*n+1<<endl;

}

int main(){

    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    io;

    solve();
    return 0;
}

#include <iostream>
#include <bits/stdc++.h>
#define Kirlos ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define ll long long
#define pb(k) push_back(k)
#define endl '\n'
#define mp(x,y) make_pair(x,y)
#define MOD 1000000007;
using namespace std;

int main()
{
    Kirlos
    ll t;
    t=1;
    //cin>>t;
    while(t--)
    {
        ll n;
        cin>>n;
        cout<<n+4<<endl;
    }
}

    #include<bits/stdc++.h>
    #define ll long long
    #define ii pair<ll,ll>
    #define vi vector<ll>
    #define F first
    #define S second
    #define pb push_back
    using namespace std;
    const ll N = 5e2 + 7, mod = 1e9 + 7;
    ll n, m, k, tt, s;

    void solve() {
        cin>>n;
        cout<<2*n+1;
    }
    int main() {
        ios_base::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        ll t = 1;
//        cin>>t;

        while(t-->0) {
            solve();
            cout << "\n";
        }
    }

#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
const int N=1000010;
ll a[N],k;
int n;

int main(){
	int n;
	cin>>n;
	if(n==1) cout<<3;
	else if(n==2) cout<<5;
	else cout<<n+4;

}

#include <bits/stdc++.h>

using namespace std;

int main(){
    long long n;
    cin >> n;
    if(n==1){
        cout << 3;
    }else{cout << n+3+(n+2)/4;}

}

// #include <bits/stdc++.h>
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<vector>
#include<vector>
#include<string>
#include<cstring>
#include<algorithm>
#include<stack>
#include<unordered_set>
#include<cmath>
#include<numeric>
#include<iterator>
#include<set>
#include<unordered_map>
#include<map>
#include<queue>
#include<cstring>
#include<stdio.h>
#include<fstream>
#include<iomanip>
#include<functional>
#include<bitset>
#include<chrono>
#include<climits>
#include<assert.h>
// #define int double
#define endl "\n"
#define ff first
#define ss second
#define ll long long int
#define db double
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vector<int>>
#define vvll vector<vector<ll>>
#define vb vector<bool>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define rep(i,n) for(ll i=0;i<n;i++)
#define rept(i,x,n) for(ll i=x;i<n;i++)
#define pb push_back
#define rev(i,a,b) for(ll i=a;i>=b;i--)
#define all(v) v.begin(),v.end()
#define tc ll tes;cin>>tes;while(tes--)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
#define coutv(v) for(auto it: (v))cout<<it<<" ";cout<<endl;
#define cout2d(v) for(auto it: (v)) {for(auto j:it) cout<<j<<" ";cout<<endl;}
#define cinv(v,n) rep(i,n){cin>>v[i];}
#define pr(s) cout<<s<<endl;

using namespace std;

#ifndef ONLINE_JUDGE
#define debug(x) cout<<#x<<" is "<<x<<endl;
#define debugv(v) cout<<#v<< " is :-"<<endl;for(auto it: (v))cout<<it<<" ";cout<<endl;
#define debug2d(v) cout<<#v<< " is :-"<<endl;cn=0;for(auto it: (v)) {cout<<cn<<" => ";cn++; for(auto j:it) cout<<j<<" ";cout<<endl;}
#define pline(x) cout<<x<<" line is reached"<<endl;
#define debugvp(v) cout<<#v<<" is :-"<<endl;for(auto i: v){cout<<"("<<i.ff<<","<<i.ss<<")"<<" ";}cout<<endl;
#define prline cout<<endl;
#define debugpair(p) cout<<#p<<" is ("<<p.ff<<","<<p.ss<<")"<<endl;
#define print(s) cout<<s<<endl;
#else
#define debug(x)
#define debugv(v)
#define debug2d(v)
#define pline(x)
#define debugvp(v)
#define prline
#define debugpair(p)
#define print(s)
#endif
ll cn;

int main() {
    ll n;
    cin>>n;
    if(n<=3){
        cout<<(2*n+1)<<"\n";
    }else{
        if((n-1)%3==0){
            cout<<6+2*((n-1)/3)<<"\n";
        }else{
            int x=(n-1)%3;
            int y=(n-1)/3;
            y*=2;
            y++;
            if(x==1){
                cout<<2*(y)+3<<"\n";
            }else if(x==2){
                cout<<2*(y)+5<<"\n";
            }
        }
    }

    return 0;

}

#include <iostream>
#include <string>
#include <cstring>
#include <set>
#include <queue>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <functional>
#pragma GCC optimize(2)
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int N = 1e5 + 10;
void solve()
{
    LL x;
    cin>>x;
    if(x==1)cout<<3<<endl;
    else if(x==2)cout<<5<<endl;
    else
    {
        x-=2;
        LL t=x/3,r=x%3;
        cout<<7+t*4+r-1<<endl;
    }
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T = 1;
    while (T--)
        solve();
    return 0;
}

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    ll n;
    cin>>n;
    cout<<((n+1)*(n+1))-(n*n);
}

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define debug(x) cerr << #x << " is " << x << endl;
#define endl '\n'
#define pb push_back
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define ll long long int
#define one(x) __builtin_popcount(x)
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
using namespace __gnu_pbds;
using namespace std;
const double pi = 3.14159265359;
ll gcd(ll a, ll b){
    if(b == 0){
        return a;
    }
    return gcd(b, a % b);
}
inline int nxt(){
    int x;
    cin >> x;
    return x;
}
void doWork(){
    ll n;
    cin >> n;
    cout << 2 * n + 1 << endl;
}
int main(){
    FastIO
    int tc = 1;
    while(tc--){
        doWork();
    }
    return 0;
}

#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<utility>
#include<set>
#include<unordered_set>
#include<list>
#include<iterator>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<bitset>
#include<random>
#include<map>
#include<unordered_map>
#include<stdio.h>
#include<complex>
#include<math.h>
#include<cstring>
#include<chrono>
#include<string>

#define lb lower_bound
#define ub upper_bound
#define ll long long
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define ln "\n"
#define all(x) (x).begin(), (x).end()
const int mod = 1e9 + 7;

ll pwr(ll a, ll b) {a %= mod; ll res = 1; while (b > 0) {if (b & 1) res = res * a % mod; a = a * a % mod; b >>= 1;} return res;}
ll mod_mul(ll a, ll b) {a = a % mod; b = b % mod; return (((a * b) % mod) + mod) % mod;}

using namespace std;

int main(){

	ios_base::sync_with_stdio(0);
	cin.tie(0);

	#ifndef ONLINE_JUDGE
    freopen("input.txt" , "r" , stdin);
    freopen("output.txt", "w", stdout);
	#endif

	ll n;
	cin >> n;
	// 3, 5, 7, 8, 9, 11, 12, 13, 15, 16, 17, 19, 20, . . . . .

	ll ans;
	if(n == 1) ans = 3;
	else if(n % 4 == 0) ans = (n / 4) * 4;
	else if(n % 4 == 3) ans = (n / 4) * 4 + 7;
	else ans = (n / 4) * 4 + 5;

	cout << ans << endl;

    return 0;
}

#include<iostream>
#include<bits/stdc++.h>
#include<map>
#include<climits>
#include<cmath>
#include<cstdlib>
#include<iterator>
#include<sstream>
using namespace std;
#define vl vector<ll>
#define vvl vector<vl>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define ll long long int
const ll inf=1e9,MOD=1e9+7;
const int largeInt=1e6;
const int N=1e7;
vector<bool> primes(N,true);
vector<int> pr;
int cnt_primes=0;

void seieve(){
    for(int i=2;i*i<=N;i++){
        if(primes[i]==true){

        for(int j=i*i;j<=N;j+=i){
            primes[j]=false;
        }
        }
    }
    for(int i=2;i<=N;i++){
        if(primes[i]){ pr.push_back(i);
        cnt_primes+=1;
        }
    }
}
vector<int> rotateArr(vector<int> &vect,int k,int n){
    vector<int> temp(vect.size());
    for(int i=0;i<vect.size();i++){
        temp[(i+k)%vect.size()]=vect[i];
    }
    return temp;
}
int fib(int n){
int prev=1,prev2=0;
repeq(i,2,n){
    int curr=prev+prev2;
    prev2=prev;
    prev=curr;

}
return prev;
}

ll stToInt(string &str){
    stringstream ss(str);
    ll x=0;
    ss>>x;
    return x;

}
bool isPrime(ll x){
    if(x<=1)
    return false;
    for(int i=2;i<=sqrt(x);i++){
        if(x%i==0)
        return false;
    }
    return true;
}

bool checkPalindrome(string& str){
    int n=str.size();
    int start=0,end=n-1;
    while(start<=end){
        if(str[start]!=str[end])
        return false;
        start++;
        end--;
    }
    return true;
}
vl revArr(vl&vect){
    int n=vect.size();
    int start=0,end=n-1;
    while(start<=end){
        swap(vect[start],vect[end]);
        start++;
        end--;
    }
    return vect;
}

string revStr(string&str){
    int n=str.size();
    int start=0,end=n-1;
    while(start<=end){
        swap(str[start],str[end]);
        start++;
        end--;
    }
    return str;
}
void primeSieve(vector<int> & prime){
    // rep(i,2,largeInt){
        for( int i=2;i<1e4;i++){
    if(prime[i]==0){
        for(int j=i*i;j<1e5;j+=i){
            prime[j]=1;
        }
    }
}
}
void isPalindrome(int ind,string &str,bool &flag,int n){
    if(ind==n){
        return;
    }

    swap(str[ind],str[ind+2]);
    isPalindrome(ind+1,str,flag,n);
    if(checkPalindrome(str)) flag=true;
    swap(str[ind],str[ind+2]);
    isPalindrome(ind+1,str,flag,n);
    if(checkPalindrome(str)) flag=true;

}
int gcd(int a, int b)
{
    return b == 0 ? a : gcd(b, a % b);
}
// int f(int ind,int D,int k,vector<int>&prime){
//     if(D==0) return 0;
//     if(ind==k-1){
//         if(D<=prime[k-1]) return 0;
//         else return 1e9;
//     }
//     int not_take=f(ind+1,D,k,prime);
//     int take=1e9;
//     if(D>=prime[ind]) take=1+f(ind,D,k,prime);

//     return min(take,not_take);

// }
// int f(int i,int j,vector<bool>& vect,vector<int>&dp){
//     if(i>=vect.size()) return 0;
//     if(dp[i]!=-1) return dp[i];
//     int bot=0;
//     if(vect[i]==0){
//         vect[i]=1;
//     bot=1+min(f(i+5,j,vect,dp),f(i+4,j,vect,dp));

//     }
//     return dp[i]=bot;

// }
int bSearch( vector<int>&vect,int i,int start,int end,int target,vector<int>&ans){
    if(start<=end){
        int mid=(start+end)/2;
        if(vect[mid]==target){
            ans[i]=vect[mid];
        return mid;
        }
        else if(target<vect[mid]){
            //  if(ans[i]<vect[mid] && vect[mid]<=target)
            //  ans[i]=mid;
        return bSearch(vect,i,start,mid-1,target,ans);
        }
        else{
            if(ans[i]<vect[mid] && vect[mid]<=target)
            ans[i]=mid;
        return bSearch(vect,i,mid+1,end,target,ans);
        }
    }
    return -1;
}
void find(vector<int>& vect1,int i,vector<int> &ans,priority_queue<pair<int,int>> &pq){
    priority_queue<pair<int,int>> g=pq;
    while(!g.empty()){
     int k=g.top().first;
     g.pop();
     if(k<=vect1[i] && i!=g.top().second){
     ans[i]=k;
     break;
     }
    }
}
int main(){

        ios_base::sync_with_stdio(false);
        cin.tie(nullptr);
        int n;
        cin>>n;
        int l=3,h=3*n+1;
        int ans=-1;
        while(l<=h){
        int mid=l+h>>1;
        int count=0;
        if(mid>=8){
            count=mid/4-1;
            if(mid&1) count+=(mid/2);
            else
            count+=(mid)/2 -1;
        }
else{
        if(mid&1) count+=(mid/2);
            else
            count+=(mid)/2 -1;}
        if(count==n) { ans=mid;break;}
        if(count>n)h=mid-1;
        if(count<n) l=mid+1;
        }

        cout<<ans<<endl;
        return 0;
    }

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){

    ll n;
    cin>>n;
    cout<<n*n-((n+1)/2)<<endl;
}

#include<iostream>
#define int long long
using namespace std;
void solve(){
	int n;
	cin>>n;
	int l=1,r=1e18;
	if(n==1){
		cout<<"1";
	}else{
			while(l<=r){
		int mid=(l+r)/2;
		int x=(mid+1)/2;
		x+=mid/4;
		x--;
		x--;
		if(x>=n){
			r=mid-1;
		}else{
			l=mid+1;
		}
		//cout<<mid<<endl;
	}
	cout<<r+1;
	}

}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	solve();
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long int n;
    cin>>n;
    if(n==1)
    {
        cout<<3<<endl;
    }
    else if(n==2)
    {
        cout<<5<<endl;
    }
    else if(n==3)
    {
        cout<<7<<endl;
    }
    else
    {
        if((n-4)%3==2)
        {
            cout<<7+4*(n-4)/3<<endl;
        }
        else if((n-4)%3==0)
        {
            cout<<8+4*(n-4)/3<<endl;
        }
        else if((n-4)%3==1)
        {
            cout<<9+4*(n-4)/3<<endl;
        }
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;

const int mod = 1000000007;
using lint = long long;
lint ipow(lint x, lint p){
	lint ret = 1, piv = x;
	while(p){
		if(p & 1) ret = ret * piv % mod;
		piv = piv * piv % mod;
		p >>= 1;
	}
	return ret;
}
vector<int> berlekamp_massey(vector<int> x){
	vector<int> ls, cur;
	int lf, ld;
	for(int i=0; i<x.size(); i++){
		lint t = 0;
		for(int j=0; j<cur.size(); j++){
			t = (t + 1ll * x[i-j-1] * cur[j]) % mod;
		}
		if((t - x[i]) % mod == 0) continue;
		if(cur.empty()){
			cur.resize(i+1);
			lf = i;
			ld = (t - x[i]) % mod;
			continue;
		}
		lint k = -(x[i] - t) * ipow(ld, mod - 2) % mod;
		vector<int> c(i-lf-1);
		c.push_back(k);
		for(auto &j : ls) c.push_back(-j * k % mod);
		if(c.size() < cur.size()) c.resize(cur.size());
		for(int j=0; j<cur.size(); j++){
			c[j] = (c[j] + cur[j]) % mod;
		}
		if(i-lf+(int)ls.size()>=(int)cur.size()){
			tie(ls, lf, ld) = make_tuple(cur, i, (t - x[i]) % mod);
		}
		cur = c;
	}
	for(auto &i : cur) i = (i % mod + mod) % mod;
	return cur;
}
int get_nth(vector<int> rec, vector<int> dp, lint n){
	int m = rec.size();
	vector<int> s(m), t(m);
	s[0] = 1;
	if(m != 1) t[1] = 1;
	else t[0] = rec[0];
	auto mul = [&rec](vector<int> v, vector<int> w){
		int m = v.size();
		vector<int> t(2 * m);
		for(int j=0; j<m; j++){
			for(int k=0; k<m; k++){
				t[j+k] += 1ll * v[j] * w[k] % mod;
				if(t[j+k] >= mod) t[j+k] -= mod;
			}
		}
		for(int j=2*m-1; j>=m; j--){
			for(int k=1; k<=m; k++){
				t[j-k] += 1ll * t[j] * rec[k-1] % mod;
				if(t[j-k] >= mod) t[j-k] -= mod;
			}
		}
		t.resize(m);
		return t;
	};
	while(n){
		if(n & 1) s = mul(s, t);
		t = mul(t, t);
		n >>= 1;
	}
	lint ret = 0;
	for(int i=0; i<m; i++) ret += 1ll * s[i] * dp[i] % mod;
	return ret % mod;
}
int guess_nth_term(vector<int> x, lint n){
	if(n < x.size()) return x[n];
	vector<int> v = berlekamp_massey(x);
	if(v.empty()) return 0;
	return get_nth(v, x, n);
}

int main()
{
    int n;cin>>n;
    cout<<guess_nth_term({3, 5, 7, 8, 9, 11, 12, 13, 15, 16, 17, 19, 20, 21, 23, 24, 25, 27, 28, 29, 31, 32, 33, 35, 36, 37, 39, 40, 41, 43, 44, 45, 47, 48, 49, 51, 52, 53, 55, 56, 57},n-1);
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define fi first
#define se second
#define mp make_pair
string alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
int dx[] = {0, 0, -1, 1};
int dy[] = {-1, 1, 0, 0};
const ll pd = 1e9 + 7; //998244353;
ll oo = 1e18 + 1, tc;
const ll MX = 100010;
void solve(){
	ll n; cin >> n;
	ll l = 1, r = 1000000000, ans = 1;
	while(l <= r) {
		ll mid = l + (r-l)/2, sm = 0;
		// i^2 - a^2 <= mid
		ll p = sqrt(mid+1);
		sm += p*(p-1)/2;
		ll st = p;
		for(ll i=st; i>=1; i--) {
			// x^2 - (x-i)^2 <= mid < x^2-(x-i-1)^2
			ll x = (mid+i*i)/(2*i);
			ll x2 = (mid+i*i+1+2*i)/(2*i+2)+1;
			x2 = max(x2, p+1);;
			sm += x-x2+1;
		}
		if(sm >= n) {
			ans = mid; r = mid-1;
		} else l = mid+1;
	}
	cout << ans << endl;
}
int main (){
	ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
	//freopen("cf.inp", "r", stdin); freopen("cf.out", "w", stdout);
	//cin >> tc; while(tc--)
	solve();
}

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

bool check(int x){
if(x%2||x%4==0)return true;
return false;

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll n,cnt=0;
    cin>>n;
    int i,c;
    if(n>=1e4) i=1e4,c=1e9;
    else i=4,c=sqrt(1e9);
    for(;i<=c;i++){
        if(check(i))cnt+=2;
        if(cnt/2==n){
            cout<<i;
            return 0;
        }
    }
}

#include <iostream>
# include <bits/stdc++.h>
using namespace std;

int main() {
    int t;
   cin>>t;
   if(t<=3)
cout<<2*t+1<<endl;
else
cout<<t+4<<endl;
   }

#include <bits/stdc++.h>
#define kareem ios_base::sync_with_stdio(false);cin.tie(0);
#define BIG 9223372036854775807
#define mod 1000000007
typedef long long ll;
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>

void go(){
    int n;
    cin >> n;
    cout << (n+1)*(n+1)-n*n;
}
int main(){
    kareem
    int t=1;
    //cin >> t;
    while(t--){
        go();
    }
    return 0;
}

//ॐ नमः शिवाय
#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main()
{
        ll n;
        cin >> n;
        n++;
        ll ans = 0;
        // ll maxi = pow(10, 9) + 1;
        ll a[n+1];
        ll t = 3;
        for (ll i = 1; i <=n+1 ; i += 3)
        {
            a[i] = t;
            a[i + 1] = t+1;
            a[i + 2] = t+2;
            t += 4;
        }
        cout << a[n] << endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

const ll mod  = 1e9 + 7;
const ld eps  = 1e-9 ;
const ll maxn = 1e5+1;
const ll inf  = 5e18 ;
const ll minf = -inf ;

#define mp make_pair
#define pb push_back
#define endl "\n"

ll check(ll n)
{
    ll ans = (n-1)/2;
    ans += n/4 - 1;
    return ans;
}

bool solve()
{
    ll n; cin>>n;
    ll low = 3, high = 1e18;
    ll ans;
    // cout<<check(109)<<endl;
    while(low <= high)
    {
        ll mid = (low + high)/2;
        ll c = check(mid);

        if( c >= n)
        {
            ans = mid;
            high = mid-1;
        }
        else
        {
            low = mid+1;
        }
        // cout<<low<<" "<<high<<endl;
    }
    cout<<ans<<endl;
    return true;
}

int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    #ifdef NOW
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    freopen("error.txt","w",stderr);
    #endif
    ll t=1;
    // cin >> t;
    while(t--)
    {
        if(solve())
        {
            // cout << "YES" << endl;
        }
        else
        {
            // cout << "NO" << endl;
        }
    }

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ul unsigned long long int
#define mk make_pair
#define all(a) (a).begin(), (a).end()
#define inp(a,n) for(int i=0; i<n; i++) cin>>a[i];

void solve() {

    ll n; cin>>n;
    ul l = 1, r = 1e18;
    while(l<=r)
    {
        ul mid = l + (r-l)/2;
        ll count = (mid-1)/2 + max((mid / 4 - 1),(ul)0);
        if(count == n)
        {
            cout<<mid<<endl;
            return;
        }
        else if(count < n)
            l = mid + 1;
        else
            r = mid - 1;
    }

}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int tc = 1;
    // cin >> tc;
    for (int t = 1; t <= tc; t++) {
        solve();
    }
}

#include<bits/stdc++.h>

using namespace std;

#define ull unsigned long long int
#define ll long long int
#define Imspeed ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl '\n'
#define MAX 100005
#define M (ll)1000000007
#define pi 3.141592653587979323846

void solu(){
  ll n;
  cin>>n;
  ll s = (ll)sqrt(n);
  if(s*s!=n) s++;
  ll r;
  if(n==s*s){
    r = (s+1)*(s+1)-1;
  }
  else if(n>s*(s-1)){
    r = (s+1)*(s+1)-1-(s*s-n);
  }
  else{
    r = (s+1)*(s+1)-2-(s*s-n);
  }
  cout<<r<<endl;
}

int main(){
  Imspeed
  int t=1;
  cin>>t;
  while(t--){
    solu();
  }
}

#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
const int N=1000010;
ll a[N],k,sum[N];
int n;
bool st[N];
bool check(int u){
	ll res=0;
	for(int i=1;a[i]<=u;i++){
		int l=1,r=i;
		while(l<r){
			int mid=l+r>>1;
			if(sum[i]-sum[mid-1]<=u) r=mid;
			else l=mid+1;
		}
		if(sum[i]-sum[l-1]<=u) res+=i-l+1;
		if(sum[i]-sum[l-1]==u) st[u]=1;
	}
	return res<=n;
}

int main(){

	cin>>n;
	for(int i=1;i<=100000;i++) a[i]=i*2+1;
	for(int i=1;i<=100000;i++) sum[i]=sum[i-1]+a[i];
	int l=1,r=100000;
	while(l<r){
		int mid=l+r+1>>1;
		if(check(mid)) l=mid;
		else r=mid-1;
	}
	while(check(l-1)&&!st[l])
	l--;
	cout<<l;

}

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define debug(x) cerr << #x << " is " << x << endl;
#define endl '\n'
#define pb push_back
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define ll long long int
#define one(x) __builtin_popcount(x)
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
using namespace __gnu_pbds;
using namespace std;
const double pi = 3.14159265359;
ll gcd(ll a, ll b){
    if(b == 0){
        return a;
    }
    return gcd(b, a % b);
}
inline int nxt(){
    int x;
    cin >> x;
    return x;
}
void doWork(){
    int n;
    cin >> n;
    vector<long double> v;
    for(int i = 1; i <= 50; ++i){
        for(int j = i + 1; j <= 50; ++j){
            ll a = i, b = j;
            a *= a, b *= b;
            long double sq = sqrt(b - a);
            v.pb(sq * sq);
        }
    }
    sort(all(v));
    cout << v[n - 1] << endl;
}
int main(){
    FastIO
    int tc = 1;
    while(tc--){
        doWork();
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
using vi=vector<long long >;
using vtod=vector<vector<long long>>;
using vpr=vector<pair<long long,long long>>;
using pi=pair<long,long>;
#define rep(i,a,b) for(long long i=a;i<b;i++)
#define rfor(i,s,n) for(long long i = n-1; i >= 0; i--)
typedef long long ll;
ll mod=1000000007;
#define pb push_back
#define F first
#define S second

void solve(){

  ll n;
  cin>>n;

  n--;

  if(n%3==0){
      ll z=n/3;

      cout<<8+(z-1)*4<<endl;
  }
  else{
      ll z=n/3;
      ll k=n-z;

      cout<<3+(k)*2<<endl;
  }

return;

}

int main(){

/*int t;
cin>>t;

while(t--){
  solve ();
}
 */

 solve();

    return 0;
}

#include<bits/stdc++.h>
#define ll long long
using namespace std;

int main() {
    int n,i,j,k,x,y,ans,curr,m;
    int tc;

    ll a;
    cin >> a;
    if(a == 1) cout << 3 << endl;
    else if(a == 2) cout << 5 << endl;
    else {
        // skip 1, 2, 4, 6, 10, 14, 18, 22, ...
        ll low = 7, high = 1e16, want = high;
        while(low <= high) {
            ll mid = (low + high) / 2;

            ll cnt = mid - 3;
            cnt -= (mid - 6 + 4) / 4;
            if(cnt == a) {
                want = mid;
                break;
            } else if(cnt > a) {
                high = mid - 1;
            } else {
                low = mid + 1;
            }
        }

        cout << want << endl;
    }

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define vi vector<int>
#define vvi vector<vi>
#define in cin >>
#define say cout <<
#define new_l cout << "\n";
#define ull unsigned long long int
#define pb push_back
#define pob pop_back
#define pii pair<int,int>
#define vboo vector<bool>
#define yes cout<<"YES";
#define no cout<<"NO";
#define unm unordered_map
#define uns unordered_set
#define ff first
#define ss second
// my defined min and max
int Max(int a, int b){
    if(a<=b)return b;
    else return a;
}
int Min(int a, int b){
    if(a>=b)return b;
    else return a;
}

//printf("%.10f", double(ans / 2.0)); decimal precision
// code here
#define mod (int)(2e9)
// For regular polygon 180 - interior angle should be divisible by 360

int total(int  n){
    int odd = (n+1)/2 - 1;
    int divBy4 = (n/4) - 1;
    return (odd + divBy4);
}
void solve(){
   int n; in n;
   // nth min.
   // b^2 - a^2 = c^2
   //say "Called";
   int s = 3, e = mod;
   while(s<=e){
     int mid = s+(e-s)/2;
     if(total(mid) == n){
        if(mid&1 || (mid>4 and mid%4 == 0)) {
            say mid;
        }
        else say mid - 1;
        return;
     }
     else if(total(mid) > n){
        e = mid - 1;
     }
     else{
        s = mid + 1;
     }
   }
  // say "loop ends";

}

int32_t main(){
//    #ifndef ONLINE_JUDGE
//         freopen("input.txt", "r", stdin);
//         freopen("output.txt", "w", stdout);
//     #endif
    int tc=1;  in tc;

    //int idx = 1;
    while(tc--){
       solve();
     new_l
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i;

    cin>>n;
   if(n == 1)
    {
        cout<<"3"<<endl;

    }
    if(n == 2)
    {
        cout<<"5"<<endl;

    }

  if(n>=3)
  {
      i=floor(n/3);
  }
  cout<<n+i+3<<endl;

    return 0;
}

#include <bits/stdc++.h>

#ifdef LOCAL_T4M0FEY
#include "debug.h"
#else
#define debug(x...) 228
#endif

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

#define fi first
#define se second

const int inf = int(1e9) + 1;
const ll infll = ll(1e18) + 1;
const int mod = int(1e9) + 7;
mt19937_64 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());

template<typename T1, typename T2>
bool chmin(T1 &a, T2 b){
    if (a > b) return a = b, true;
    return false;
}
template<typename T1, typename T2>
bool chmax(T1 &a, T2 b){
    if (a < b) return a = b, true;
    return false;
}
void solve_case(){
    ll left = 0, right = infll;
    int n;
    cin >> n;
    while (right - left > 1){
        ll mid = (left + right) / 2;
        if (mid - (mid / 4 + 1) >= n){
            right = mid;
        }
        else{
            left = mid;
        }
    }
    cout << right + 2 << "\n";
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
#ifdef LOCAL_T4M0FEY
    freopen("inputik.txt", "r", stdin);
    clock_t tStart = clock();
#endif
    int T = 1;
    while (T--){
        solve_case();
    }
#ifdef LOCAL_T4M0FEY
    fprintf(stderr, "\n>> Runtime: %.10fs\n", (double) (clock() - tStart) / CLOCKS_PER_SEC);
#endif
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int long long
typedef pair<int, int>PII;
#define x first
#define y second
const int inf = 0x3f3f3f3, N = 2e5+10, mod = 1e9+7;
const int M=1e7+1010;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const double pi = acos(-1.0);
typedef pair<int, int> PII;
int n;
bool check(int mid){
    if(n>=((mid-1)/2)+max(mid/4-1,0ll))return true;
    return false;
}
inline void solve(){
    int l=0,r= 2e9;
    cin>>n;
    while(l<r){
        int mid =l+r+1>>1;
        if(check(mid))l=mid;
        else r= mid-1;
    }
    cout<<r<<'\n';
}
signed main() {
    int _=1;
    //cin>>_;
    while (_--)solve();
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

typedef pair<double, double> pdd;
typedef pair<int, int> pii;
typedef long long ll;

#define reset(a) memset(a, 0, sizeof(a))
#define maxn 200200
#define maxbit 22
#define bit(x, i) ((x >> i) & 1)
#define ALPHABET 26
#define task ""

const int inf = 1e9;
const int mod = (1e9) + 7;

namespace caculate{
    template<class T>
    void add(T& x, T y){
        x += y;
        if(x >= mod) x -= mod;
    }
    template<class T>
    void sub(T& x, T y){
        x -= y;
        if(x < 0) x += mod;
    }
    template<class T>
    void maximize(T& x, T y){
        if(x < y) x = y;
    }
    template<class T>
    void minimize(T& x, T y){
        if(x > y) x = y;
    }
}
using namespace caculate;

int n;

int cnt(int x){
    int res = (x - 3) / 2 + 1;
    if(x >= 8) res += (x / 4 - 1);
    return res;
}

void process(){
    cin >> n;
    int l = 2, r = 2000000000;
    while(r - l > 1){
        int mid = (l + r) / 2;
        if(cnt(mid) >= n) r = mid;
        else l = mid;
    }
    cout << r;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    if (fopen(task ".inp", "r"))
    {
        freopen(task ".inp", "r", stdin);
        freopen(task ".out", "w", stdout);
    }
    process();
    return 0;
}

#include <bits/stdc++.h>
// include <ext/pb_ds/assoc_container.hpp>
// include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;
#define all(x) x.begin(), x.end()
#define pb push_back
// define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
#define mpr make_pair
#define ln '\n'
void IO(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);}
#define int long long
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n; cin >> n;
	cout << n*2+1;
}

#include <bits/stdc++.h>

// plociy based ds
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

// order_of_key (k) : Number of items strictly smaller than k .
// find_by_order(k) : K-th element in a set (counting from zero).
using namespace std;
using namespace __gnu_pbds;

// pbds
typedef tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update> pbds; // find_by_order, order_of_key

// macros
#define log 19
#define int long long int
#define F first
#define S second
#define pb push_back
#define si set<int>
#define vi vector<int>
#define vii vector<vector<int>>
#define pii pair<int, int>
#define vpi vector<pii>
#define vpp vector<pair<int, pii>>
#define mii map<int, int>
#define mpi map<pii, int>
#define spi set<pii>
#define endl "\n"
#define sz(x) ((int)x.size())
#define all(p) p.begin(), p.end()
#define double long double
#define Read(v)      \
    for (int &a : v) \
        cin >> a;
#define que_max priority_queue<int>
#define que_min priority_queue<int, vi, greater<int>>
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
#define print(a)          \
    for (auto x : a)      \
        cout << x << " "; \
    cout << endl
#define print1(a)    \
    for (auto x : a) \
    cout << x.F << " " << x.S << endl
#define print2(a, x, y)         \
    for (int i = x; i < y; i++) \
        cout << a[i] << " ";    \
    cout << endl

// debug
template <typename Arg1>
void __f(const char *name, Arg1 &&arg1) { cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&...args)
{
    const char *comma = strchr(names + 1, ',');
    cout.write(names, comma - names) << " : " << arg1 << " | ";
    __f(comma + 1, args...);
}

// power function

inline int power(int a, int b)
{
    int x = 1;
    while (b)
    {
        if (b & 1)
            x *= a;
        a *= a;
        b >>= 1;
    }
    return x;
}
int modpower(int x, int y, int p)
{
    if (y == 0)
        return 1;
    int temp = modpower(x, y / 2, p);
    temp = (1LL * temp * temp) % p;
    if (y & 1)
    {
        temp = (1LL * temp * x) % p;
    }
    return temp;
}
int mmi(int b, int mo)
{
    int inv_b = modpower(b, mo - 2, mo);

    return inv_b;
}

// constant
double pi = 3.14159265358979323846264338327950;
const int mod = 1e9 + 7;
const int N = 5e5 + 5;
int inf = 9e18;
int ninf = -9e18;

// check number is power of 2 or not
bool isPowerOfTwo(int x)
{

    return x && (!(x & (x - 1)));
}

// dsu
// vector<int> pa(N, 0);

// vector<int> Size(N, 0);

// void make(int a)
// {
//     pa[a] = a;

//     Size[a] = 1;
// }

// int get(int a)
// {
//     if (pa[a] == a)
//     {
//         return a;
//     }

//     return pa[a] = get(pa[a]);
// }

// void Union(int a, int b)
// {
//     a = get(a);
//     b = get(b);

//     if (a != b)
//     {
//         if (Size[a] < Size[b])
//         {
//             swap(a, b);
//         }

//         Size[a] += Size[b];
//         pa[b] = a;
//     }
// }

/*********************************************** Main Code ***********************************************/

void solve()
{

    int n;
    cin >> n;

    int l = 0, r = 1e12;

    auto check = [&](int a)
    {
        int x = a / 4 - 1;

        if (a & 1)
        {
            x += a / 2;
        }
        else
        {
            x += a / 2 - 1;
        }

        return n<=x;
    };

    int ans;
    while (l <= r)
    {

        int mid = (l + r) / 2;

        if (check(mid))
        {
            r = mid - 1;
            ans = mid;
        }
        else
        {
            l = mid + 1;
        }
    }
    cout << ans << endl;
}

/*************** main *****************/
int32_t main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    // main code

    int t = 1;
    // cin >> t;

    while (t--)
    {
        solve();
    }

    // debug
    // cerr << "Run Time : " << ((double)(clock() - z) / CLOCKS_PER_SEC);

    return 0;
}

// #pragma comment(linker, "/STACK:102400000,102400000")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("O2")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
//#pragma GCC optimize("trapv")
//#pragma GCC optimize(3,"Ofast","inline")
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<ctime>
#include<bitset>
#include<unordered_map>
#include<unordered_set>
using namespace std;
using in = __int128;

#define ios std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define INF 0x3f3f3f3f3f3f3f3fll
#define inf 0x3f3f3f3f
#define lowbit(x) x & -x
#define sqr(x) ((x) * (x))
#define pb push_back
#define se second
#define fi first
#define endl '\n'
#define vi vector<int>
#define vl vector<long long>
#define vii vector<pair<int, int>>
#define all(x) (x).begin(), (x).end()
#define D(x) cout << "BUG:  " << (x) << '\n'
#define DD(x, y) cout << "BUG:  " << (x) << "  " << (y) << '\n'
//#define int long long
const int M = 1e5 + 10, N = 1e6 + 10, mod = 1e9 + 7;

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
template <typename T> void inline re(T &x) {
    int f = 1; x = 0; char s = getchar();
    while (s < '0' || s > '9') { if (s == '-') f = -1; s = getchar(); }
    while (s <= '9' && s >= '0') x = x * 10 + (s ^ 48), s = getchar();
    x *= f;
}
template <typename T> void inline pr(T x) {
    if (x < 0) { putchar('-'); pr(-x); return ; }
    if (x >= 10) pr(x / 10);
    putchar((x % 10) + '0');
}

ll qpow(ll a,ll b){ll ans=1;while(b){if(b&1)ans=ans*a%mod;a=a*a%mod;b>>=1;}return ans;}
ll qpow(ll a,ll b,ll p){ll ans=1;while(b){if(b&1)ans=ans*a%p;a=a*a%p;b>>=1;}return ans;}
ll inv(ll x){return qpow(x,mod-2);}

//----------------------------------------------------------------------------------------//
int a[1000000+10]=
{8,1333336,2666669,4000003,5333336,6666669,8000003,9333336,10666669,12000003,13333336,
14666669,16000003,17333336,18666669,20000003,21333336,22666669,24000003,25333336,26666669,
28000003,29333336,30666669,32000003,33333336,34666669,36000003,37333336,38666669,40000003,
41333336,42666669,44000003,45333336,46666669,48000003,49333336,50666669,52000003,53333336,
54666669,56000003,57333336,58666669,60000003,61333336,62666669,64000003,65333336,66666669,
68000003,69333336,70666669,72000003,73333336,74666669,76000003,77333336,78666669,80000003,
81333336,82666669,84000003,85333336,86666669,88000003,89333336,90666669,92000003,93333336,
94666669,96000003,97333336,98666669,100000003,101333336,102666669,104000003,105333336,106666669,
108000003,109333336,110666669,112000003,113333336,114666669,116000003,117333336,118666669,120000003,
121333336,122666669,124000003,125333336,126666669,128000003,129333336,130666669,132000003,133333336,
134666669,136000003,137333336,138666669,140000003,141333336,142666669,144000003,145333336,146666669,
148000003,149333336,150666669,152000003,153333336,154666669,156000003,157333336,158666669,160000003,
161333336,162666669,164000003,165333336,166666669,168000003,169333336,170666669,172000003,173333336,
174666669,176000003,177333336,178666669,180000003,181333336,182666669,184000003,185333336,186666669,
188000003,189333336,190666669,192000003,193333336,194666669,196000003,197333336,198666669,200000003,
201333336,202666669,204000003,205333336,206666669,208000003,209333336,210666669,212000003,213333336,
214666669,216000003,217333336,218666669,220000003,221333336,222666669,224000003,225333336,226666669,
228000003,229333336,230666669,232000003,233333336,234666669,236000003,237333336,238666669,240000003,
241333336,242666669,244000003,245333336,246666669,248000003,249333336,250666669,252000003,253333336,
254666669,256000003,257333336,258666669,260000003,261333336,262666669,264000003,265333336,266666669,
268000003,269333336,270666669,272000003,273333336,274666669,276000003,277333336,278666669,280000003,
281333336,282666669,284000003,285333336,286666669,288000003,289333336,290666669,292000003,293333336,
294666669,296000003,297333336,298666669,300000003,301333336,302666669,304000003,305333336,306666669,
308000003,309333336,310666669,312000003,313333336,314666669,316000003,317333336,318666669,320000003,
321333336,322666669,324000003,325333336,326666669,328000003,329333336,330666669,332000003,333333336,
334666669,336000003,337333336,338666669,340000003,341333336,342666669,344000003,345333336,346666669,
348000003,349333336,350666669,352000003,353333336,354666669,356000003,357333336,358666669,360000003,
361333336,362666669,364000003,365333336,366666669,368000003,369333336,370666669,372000003,373333336,
374666669,376000003,377333336,378666669,380000003,381333336,382666669,384000003,385333336,386666669,
388000003,389333336,390666669,392000003,393333336,394666669,396000003,397333336,398666669,400000003,
401333336,402666669,404000003,405333336,406666669,408000003,409333336,410666669,412000003,413333336,
414666669,416000003,417333336,418666669,420000003,421333336,422666669,424000003,425333336,426666669,
428000003,429333336,430666669,432000003,433333336,434666669,436000003,437333336,438666669,440000003,
441333336,442666669,444000003,445333336,446666669,448000003,449333336,450666669,452000003,453333336,
454666669,456000003,457333336,458666669,460000003,461333336,462666669,464000003,465333336,466666669,
468000003,469333336,470666669,472000003,473333336,474666669,476000003,477333336,478666669,480000003,
481333336,482666669,484000003,485333336,486666669,488000003,489333336,490666669,492000003,493333336,
494666669,496000003,497333336,498666669,500000003,501333336,502666669,504000003,505333336,506666669,
508000003,509333336,510666669,512000003,513333336,514666669,516000003,517333336,518666669,520000003,
521333336,522666669,524000003,525333336,526666669,528000003,529333336,530666669,532000003,533333336,
534666669,536000003,537333336,538666669,540000003,541333336,542666669,544000003,545333336,546666669,
548000003,549333336,550666669,552000003,553333336,554666669,556000003,557333336,558666669,560000003,
561333336,562666669,564000003,565333336,566666669,568000003,569333336,570666669,572000003,573333336,
574666669,576000003,577333336,578666669,580000003,581333336,582666669,584000003,585333336,586666669,
588000003,589333336,590666669,592000003,593333336,594666669,596000003,597333336,598666669,600000003,
601333336,602666669,604000003,605333336,606666669,608000003,609333336,610666669,612000003,613333336,
614666669,616000003,617333336,618666669,620000003,621333336,622666669,624000003,625333336,626666669,
628000003,629333336,630666669,632000003,633333336,634666669,636000003,637333336,638666669,640000003,
641333336,642666669,644000003,645333336,646666669,648000003,649333336,650666669,652000003,653333336,
654666669,656000003,657333336,658666669,660000003,661333336,662666669,664000003,665333336,666666669,
668000003,669333336,670666669,672000003,673333336,674666669,676000003,677333336,678666669,680000003,
681333336,682666669,684000003,685333336,686666669,688000003,689333336,690666669,692000003,693333336,
694666669,696000003,697333336,698666669,700000003,701333336,702666669,704000003,705333336,706666669,
708000003,709333336,710666669,712000003,713333336,714666669,716000003,717333336,718666669,720000003,
721333336,722666669,724000003,725333336,726666669,728000003,729333336,730666669,732000003,733333336,
734666669,736000003,737333336,738666669,740000003,741333336,742666669,744000003,745333336,746666669,
748000003,749333336,750666669,752000003,753333336,754666669,756000003,757333336,758666669,760000003,
761333336,762666669,764000003,765333336,766666669,768000003,769333336,770666669,772000003,773333336,
774666669,776000003,777333336,778666669,780000003,781333336,782666669,784000003,785333336,786666669,
788000003,789333336,790666669,792000003,793333336,794666669,796000003,797333336,798666669,800000003,
801333336,802666669,804000003,805333336,806666669,808000003,809333336,810666669,812000003,813333336,
814666669,816000003,817333336,818666669,820000003,821333336,822666669,824000003,825333336,826666669,
828000003,829333336,830666669,832000003,833333336,834666669,836000003,837333336,838666669,840000003,
841333336,842666669,844000003,845333336,846666669,848000003,849333336,850666669,852000003,853333336,
854666669,856000003,857333336,858666669,860000003,861333336,862666669,864000003,865333336,866666669,
868000003,869333336,870666669,872000003,873333336,874666669,876000003,877333336,878666669,880000003,
881333336,882666669,884000003,885333336,886666669,888000003,889333336,890666669,892000003,893333336,
894666669,896000003,897333336,898666669,900000003,901333336,902666669,904000003,905333336,906666669,
908000003,909333336,910666669,912000003,913333336,914666669,916000003,917333336,918666669,920000003,
921333336,922666669,924000003,925333336,926666669,928000003,929333336,930666669,932000003,933333336,
934666669,936000003,937333336,938666669,940000003,941333336,942666669,944000003,945333336,946666669,
948000003,949333336,950666669,952000003,953333336,954666669,956000003,957333336,958666669,960000003,
961333336,962666669,964000003,965333336,966666669,968000003,969333336,970666669,972000003,973333336,
974666669,976000003,977333336,978666669,980000003,981333336,982666669,984000003,985333336,986666669,
988000003,989333336,990666669,992000003,993333336,994666669,996000003,997333336,998666669
};
void solve()
{//ios;
int T=1;
//re(T);
while(T--)
{  ll n;
   re(n);

 int pos=n/1000000;

  if(pos==0)
  {int cnt=3,x=7;
    if(n==1)cout<<3;
 else if(n==2)cout<<5;
 else if(n==3)cout<<7;
 else
 {
while(cnt<n)
  { x++;
   if(x%2==1||(x/2%2==0)){cnt++;}

  }
 cout<<x;

 }
  }

else{

  int cnt=pos*1000000,x=a[pos];
 while(cnt<n)
  {x++;
   if(x%2==1||(x/2%2==0)){cnt++;}

  }
  cout<<x;

}

}

}
signed main()
{
#ifdef  ran
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
//ios;
 //int size(512<<20);  // 512M
    //__asm__ ( "movq %0, %%rsp\n"::"r"((char*)malloc(size)+size));
    // YOUR CODE

 solve();

//exit(0);
}

#include<bits/stdc++.h>
#define re register
#define inl inline
#define ll long long
using namespace std;
int read(){
	int sum=0,f=1;char c=getchar();
	while(!isdigit(c)){if(c=='-') f=-1;c=getchar();}
	while(isdigit(c)){sum=(sum<<3)+(sum<<1)+(c^48);c=getchar();}
	return sum*f;
}

int main(){
	int n=read();
	printf("%d",n+n+1);
	return 0;
}

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	long long n;
	cin>>n;

	if(n <= 3)
	cout<<((n+1)*(n+1) - (n*n));
	else if(n == 4)
	cout<<8;
	else if(n == 5)
	cout<<9;
	else
	cout<<n+5;
	return 0;
}

#include <cstdio>
int n;
int main() {
	scanf("%d", &n);
	if (n == 1) puts("4");
	else if (n == 2) puts("5");
	else if (n == 3) puts("7");
	else {
		n -= 4;
		int m = n / 3;
		long long s = (m + 2) * 4;
		m = n % 3;
		if (m == 1) s ++;
		if (m == 2) s += 2;
		printf("%lld\n", s);
	}
	return 0;
}

#include <iostream>
using namespace std;
typedef long long ll;
int n;

int main() {
    scanf("%d", &n);
    ll l = 3, r = INT_MAX, res;
    while (l <= r) {
        int mid  = (l + r) >> 1;
        if ((mid - 1) / 2 + max(0, mid / 4 - 4) >= n) {
            res = mid, r = mid - 1;
        }
        else l = mid + 1;
    }
    printf("%d", res);
    return 0;
}

    #include<bits/stdc++.h>
using namespace std;

#define ll long long int
#define dd double
#define sg string
#define modd 1000000007
#define en "\n"
#define sc(a) scanf("%lld",&a);
#define f(i,a,n) for(ll i=a;i<n;i++)
#define ps(a) printf("%lld ",a);
#define pn(a) printf("%lld\n",a);

int main()
{
    freopen("in.txt", "r", stdin);
    ll a,b,c,d,t,mm,k,aa,bb,n,m;

    sc(n)
    c = (2*n) + 1;
    pn(c)

    return 0;
}

#include <bits/stdc++.h>
#include <unordered_set>

using namespace std;
#define int long long

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    int n;
    cin >> n;
    if (n == 1) {
        cout << 3 << "\n";
    }
    else {
        if ((n - 1) % 3 == 0) {
            cout << 8 + 4 * (n / 3 - 1) << "\n";
        }
        else {
            cout << 2 * (n - n / 4) + 1 << "\n";
        }
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define int long long
int n;
bool isgood(int m)
{
	return ((m%2==0 ? m/2-1 : m/2))+(m/4-1)>=n;
}
bool check(int r)
{
	return (r%2==1 || r%4==0);
}
signed main()
{
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	cin >> n;
	int l=0, r=1e18;
	while (r-l>1)
	{
		int m=(l+r)/2;
		if (isgood(m)) r=m;
		else l=m;
	}
	while (!check(r)) r--;
	cout << r;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ul unsigned long long int
#define mk make_pair
#define all(a) (a).begin(), (a).end()
#define inp(a,n) for(int i=0; i<n; i++) cin>>a[i];

void solve() {

    ll n; cin>>n;
    ul l = 1, r = 1e18;
    while(l<=r)
    {
        ul mid = l + (r-l)/2;
        ll count = (mid-1)/2 + (mid / 4 - 1);
        if(count == n)
        {
            cout<<mid<<endl;
            return;
        }
        else if(count < n)
            l = mid + 1;
        else
            r = mid - 1;
    }

}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int tc = 1;
    // cin >> tc;
    for (int t = 1; t <= tc; t++) {
        solve();
    }
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    long long l = 3, r = 10 * n;
    while (l < r)
    {
        long long mid = (l + r) >> 1;
        int cnt = (mid + 1) / 2 - 1 + max(0ll, mid / 4 - 1);
        if (cnt >= n)
            r = mid;
        else
            l = mid + 1;
    }
    cout << l << endl;
}

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <math.h>

int main()
{
    int n;
    std::cin >> n;
    if (n == 1)
    {
        std::cout << 3;
    }
    if (n == 2)
    {
        std::cout << 5;
    }
    else
    {
        int a = 5 + (n/3) + n - 2;
        std::cout << a;
    }
}

/*

    author: SamTheMathlete
    submitted on: "<cmd + k> on me"

*/

#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define E '\n'
#define sp <<" "<<

using namespace std;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll n;
    cin >> n;
    cout << (2 * n + (n % 2 ? 1 : -1)) << E;
    return 0;
}

using namespace std;
#include <bits/stdc++.h>
#define forn(i, s, n) for (int i = s; i < n; i++)
#define debug(x) cout << #x << " = " << x << '\n'
#define vdebug(v)                                                              \
    cout << #v << " = ";                                                       \
    for (auto _i : v) {                                                        \
        cout << _i << ' ';                                                     \
    };                                                                         \
    cout << '\n';
#define input(v)                                                               \
    for (auto& i : v) {                                                        \
        cin >> i;                                                              \
    }
template <typename C> struct rge { C l, r; };
template <typename C> rge<C> range(C i, C j) {
    return rge<C>{i, j};
}
template <typename C> ostream& operator<<(ostream& os, rge<C>& r) {
    os << '{';
    for (auto it = r.l; it != r.r; it++)
        os << ", " + (it == r.l) << *it;
    os << '}';
    return os;
}
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& p) {
    return os << '{' << p.first << ", " << p.second << '}';
}
template <typename T_container, typename T = typename enable_if<
                                    !is_same<T_container, string>::value,
                                    typename T_container::value_type>::type>
ostream& operator<<(ostream& os, const T_container& v) {
    os << '{';
    string sep;
    for (const T& x : v)
        os << sep << x, sep = ", ";
    return os << '}';
}
void dbg_out() {
    cerr << ']' << endl;
}
template <typename A> void dbg_out(A H) {
    cerr << H;
    dbg_out();
}
template <typename A, typename B, typename... C>
void dbg_out(A H, B G, C... T) {
    cerr << H << ", ";
    dbg_out(G, T...);
}
#ifndef ONLINE_JUDGE
#define dbg(...)                                                               \
    cerr << "DBG : " << #__VA_ARGS__ << " => [", dbg_out(__VA_ARGS__)
#else
#define dbg(...)
#endif
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned uint;

int digital_log(int n) {
    int count = 0;
    while (n) {
        n /= 10;
        ++count;
    }
    return count;
}

void solve() {
    long n;
    cin >> n;
    if (n >= 4) {
        cout << n + ((n - 2)/4) +  4 << '\n';
    } else if (n == 3) {
        cout << 7 << '\n';
    } else if (n == 2) {
        cout << 5 << '\n';
    } else {
        cout << 3 << '\n';
    }
}

int main() {
    solve();
}

#include <iostream>

using namespace std;

long long check4(long long n) {
	if((long long)(n/4)==1)
		return 0;
	return n/4;
}
long long checkodd(long long n) {
	return n/2 + bool(n&1) - 1;
}
long long check(long long n) {
	if(n>=3 && n&1)
		return n;
	if(n>=8 && n %4 ==0)
		return n;
	return check(n-1);
}
signed main() {
	long long n ; cin>>n;
	long long l = 3 ;
	long long r = 10000000000000;
	long long mid;
	while(l<r) {
		mid = l + (r-l)/2;
		if( checkodd(mid) + check4(mid) >= n)
			r = mid  ;
		else
			l = mid + 1;
	}
	r = check(r);
	cout<<r;
}

#include <iostream>
#include <string>
#include <cstring>
#include <set>
#include <queue>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <functional>
#pragma GCC optimize(2)
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int N = 1e5 + 10;
void solve()
{
    int x;
    cin>>x;
    cout<<(LL)(x+1)*(x+1)-(LL)x*x<<endl;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T = 1;
    while (T--)
        solve();
    return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	int n; cin >> n;
	if (n == 1)
	{
		cout << 3 << endl;
		return 0;
	}
	cout << 4 * n / 3 + 3 << endl;
	return 0;
}

/*
       submitedd by :)
        ███╗░░░███╗░█████╗░░██████╗████████╗░█████╗░███████╗░█████╗░
        ████╗░████║██╔══██╗██╔════╝╚══██╔══╝██╔══██╗██╔════╝██╔══██╗
        ██╔████╔██║██║░░██║╚█████╗░░░░██║░░░███████║█████╗░░███████║
        ██║╚██╔╝██║██║░░██║░╚═══██╗░░░██║░░░██╔══██║██╔══╝░░██╔══██║
        ██║░╚═╝░██║╚█████╔╝██████╔╝░░░██║░░░██║░░██║██║░░░░░██║░░██║
        ╚═╝░░░░░╚═╝░╚════╝░╚═════╝░░░░╚═╝░░░╚═╝░░╚═╝╚═╝░░░░░╚═╝░░╚═╝

        //Don't wish for it  Work for it
*/

#include <bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
#define input  freopen("divide.in","rt",stdin);
#define output  freopen("output.txt","wt",stdout);
#define cin(v) for(auto &ele:v)cin>>ele
#define all(v) v.begin(),v.end()
#define ln cout<<'\n';
#define pp pair<int,int>
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define vc vector
#define ll long long
using namespace std;
int xd[8]={-1,0,1, 0,-1,-1, 1, 1};
int yd[8]={ 0,1,0,-1, 1,-1, 1,-1};

//===============================The solution===============================

void solve() {
    int n;cin>>n;
    if (n==1)return void (cout<<3);
    if (n==2)return void (cout<<5);
    ll st=1,en=1e10;
    while (st<=en){
        ll mid=(st+en)/2;
        ll ele=(mid&1?mid/2:mid/2-1)+mid/4-1;
        if (ele>n)en=mid-1;
        else if (ele<n)st=mid+1;
        else return void (cout<<mid);
    }
}
int main() {
    fast
    int t=1;cin>>t;
    while (t--) {
        solve();ln
    }
}

#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef pair<ll,ll> pll;
typedef pair<ll,pii> plii;
typedef pair<int,pii> piii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<pil> vil;
typedef vector<piii> viii;
typedef vector<pli> vli;
typedef vector<ll> vl;
const int N=500005;
const int M=1005;
const int moh=1e9+3;
const ll mod=998244353 ;
const int base=311;
const int oi=1e9+1;
const ll oo=1e15;
const double eps=1e-9;
int dx[]={0,1,0,-1,1,-1,1,-1};
int dy[]={-1,0,1,0,1,-1,-1,1};
int n,a[N],d;
bool check(ll x) {
    return x/4+(x+1)/2-2>=n;
}
void solve() {
    cin>>n;
    ll l=1,r=1e18,ans;
    while (l<=r) {
        ll mid=(l+r)/2;
        if (check(mid)) {
            ans=mid;
            r=mid-1;
        }
        else {
            l=mid+1;
        }
    }
    cout<<ans;
}
int main() {
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//    freopen("a.inp","r",stdin);
//    freopen("a.out","w",stdout);
    int test=1;
    while (test--) {
        solve();
    }
}

#include<bits/stdc++.h>

#define int long long
#define loop(i,start,end) for(int i=start;i<end;++i)
#define veci vector<int>
#define pr pair<int,int>
#define mpp map<int,int>
#define yes cout<<"YES"<<endl;
#define no cout<<"NO"<<endl;
#define all(x) x.begin(),x.end()
#define pb push_back
const int M = 1e9+7;

using namespace std;

void solve(){
    int n;cin>>n;
    if(n<=3){
        cout<<2*n+1<<endl;return;
    }
    n-=3;
    cout<<10+n+n/4<<endl;
}

signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);

    int tc=1;
    // cin>>tc;
    while(tc--)
    {
        solve();
    }
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main(){
    long long n;
    cin >> n;
    if(n==1){
        cout << 3;
    }else{cout << n+3+(n+2)/4;}

}

#include <bits/stdc++.h>
// include <ext/pb_ds/assoc_container.hpp>
// include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;
#define all(x) x.begin(), x.end()
#define pb push_back
// define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
#define mpr make_pair
#define ln '\n'
void IO(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);}
#define int long long
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n; cin >> n;
	cout << n*2+1;
}

#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
const int N=1000010;
ll a[N],k,sum[N];
int n;
bool st[N];
bool check(int u){
	ll res=0;
	for(int i=1;a[i]<=u;i++){
		int l=1,r=i;
		while(l<r){
			int mid=l+r>>1;
			if(sum[i]-sum[mid-1]<=u) r=mid;
			else l=mid+1;
		}
		if(sum[i]-sum[l-1]<=u) res+=i-l+1;
		if(sum[i]-sum[l-1]==u) st[u]=1;
	}
	return res<=n;
}

int main(){

	cin>>n;
	for(int i=1;i<=100000;i++) a[i]=i*2+1;
	for(int i=1;i<=100000;i++) sum[i]=sum[i-1]+a[i];
	int l=1,r=100000;
	while(l<r){
		int mid=l+r+1>>1;
		if(check(mid)) l=mid;
		else r=mid-1;
	}
	while(check(l-1)&&!st[l])
	l--;
	cout<<l;

}

#include<iostream>
using namespace std;
int main()
{
	int a,b;
	cin>>a;
	cout<<a+a+1;
}

#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int count = 3;
    for(int i=1 ; i<n ; i++){
        count+=2;
    }
    cout << count << endl;
    return 0;
}

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef int ii;
typedef unsigned long long ull;
typedef long long int lint;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
#define shekoo ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
template <typename T>
using ordered_set = tree<T, null_type,less_equal<T>, rb_tree_tag,tree_order_statistics_node_update>;
#define of(m) find_by_order((m)) //random access of ordered set
#define all(v) (v).begin(),(v).end()
#define r_all(v) (v).rbegin(),(v).rend()
#define cnt_0s_lr(x) __builtin_clz(x) //It counts number of zeros before the first occurrence of one(set bit)
#define cnt_0s_rl(x) __builtin_ctz(x) //Count no of zeros ff last tt first occurrence of one(set bit).
#define popcnt(x) __builtin_popcount(x) //Count no of zeros ff last tt first occurrence of one(set bit).
#define s(v) (v).size()
#define endl "\n";
#define NO cout << "NO\n";
#define YES cout << "YES\n";
#define No cout << "No\n";
#define Yes cout << "Yes\n";
#define no cout << "no\n";
#define yes cout << "yes\n";
#define PF push_front
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define rep(i, m) for(ll i=0;i<(m);++i)
#define rep_inv(i,m) for(ll i=(m);i>=0;--i)
#define repn(i,in, m) for(ll i=(in);i<(m);++i)
#define repn_inv(i,m,in) for(ll i=(in);i>=(m);--i)
#define repa(i, x) for(auto &i: x)
#define clr(a) memset((a),0,sizeof(a))
#define clrdp(a) memset((a),-1,sizeof(a))
#define vi vector<int>
#define vll vector<ll>
#define vg vector<pair<ll,ll>>
#define Pi M_PI
#define UNIQUE(c) (c).resize(unique(all(c)) - (c).begin())
#define st_int(s, base) stoi((s), 0 , (base))
#define st_ll(s, base) stoll((s), 0 , (base))
#define ch_st(c) string sch(1, (c))
#define stream(line) istringstream in((line)) //split string by spaces and can be accessed in >> s >> m >> s...
#define least_multiple_of_a(a, l) (((l) - 1) / (a) + 1) * (a) // l -> start value

void print_vec(vector<ll>& v){
    for(ll i=0; i<s(v); i++) cout << v[i] << " ";
    cout << endl
}

/// Main masks operations
ll set_bit(ll num, ll idx, ll value = 1){ return (value) ? (num | (1ll<<idx)) : (num & ~(1ll<<idx)); }
ll get_bit(ll num, ll idx){ return ((num >> idx) & 1ll) == 1; }
ll cnt_bits(ll num){ ll ret = 0; while(num){ if(num%2) ret++; num /= 2; } return ret; }
ll set_all_bits_from_1_n(ll n){ return (1ll<<n)-1; }

int main() {
    shekoo
    ll n; cin >> n;
    if(n == 1) return cout << 3, 0;
    if(n == 2) return cout << 5 , 0;
    if(n == 3) return cout << 7 , 0;
    if(n == 4) return cout << 8 , 0;
    if(n == 5) return cout << 9 , 0;
    ll ans = n + ((n+(n/2)+3)/4) + 2;
    cout << ans;
    return 0;
}

#include<bits/stdc++.h>

using namespace std;

#define ull unsigned long long int
#define ll long long int
#define Imspeed ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl '\n'
#define MAX 100005
#define M (ll)1000000007
#define pi 3.141592653587979323846

void solu(){
  ll n;
  cin>>n;
  n--;
  ll s = sqrt(n);
  ll r;
  if(n==s*s){
    r = (s+1)*(s+1)+1;
  }
  else if(n<s*(s+1)){
    r = (s+1)*(s+1)+1+(n-s*s);
  }
  else{
    r = (s+1)*(s+1)+2+(n-s*s);
  }
  cout<<(ll)r<<endl;
}

int main(){
  Imspeed
  int t=1;
  //cin>>t;
  while(t--){
    solu();
  }
}

#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<bits/stdc++.h>

using namespace std;
const int mod = 1e9+7;

void solve()
{

    long long n; cin >> n;

    cout << n+4+ceil(n/3)-1 << '\n';

}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int tt=1;
   // cin >> tt;
    while(tt--){
        solve();

    }

    return 0;
}

    #include <iostream>
    #include <bits/stdc++.h>
    #include <cstring>
    using namespace std;
    #define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL)
    #define int long long
    #define flp(i, a, b) for(int i = a;i < b;i++)
    #define flp_inv(i, a, b) for(int i = a;i >= b;i--)
    #define pb push_back
    #define vi vector<int>
    #define vvi vector<vector<int>>
    #define vll vector<ll>
    //Comd Begins Here .. //
    void solve()
    {
      int n;
      cin>>n;
      if(n==1) {
        cout<<"1\n";
        return;
      }
      if(n==2) {
        cout<<"5\n";
        return;
      }
      int p=7+n-3;
      if((p%2==0)&&((p/2)%2!=0))
       p++;
       cout<<p<<"\n";
    }
    signed main()
    {  fast_io;
    int t;
    // cin>>t;

    {
        solve();
    }
     }

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(), (x).end()

int main(){
    ll n; cin>>n;
    if(n==1){
        cout<<3<<endl;
    }
    else{
        n--;
        int x=n/3; int y=n%3;
        if(y==1) cout<<4*(x+1)+1<<endl;
        else if(y==2) cout<<4*(x+1)+3<<endl;
        else cout<<4*(x+1)+4<<endl;
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

const ll mod  = 1e9 + 7;
const ld eps  = 1e-9 ;
const ll maxn = 1e5+1;
const ll inf  = 5e18 ;
const ll minf = -inf ;

#define mp make_pair
#define pb push_back
#define endl "\n"

bool solve()
{
    ll n; cin>>n;
    cout<<(n+1)*(n+1) - n*n<<endl;
    return true;
}

int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    #ifdef NOW
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    freopen("error.txt","w",stderr);
    #endif
    ll t=1;
    // cin >> t;
    while(t--)
    {
        if(solve())
        {
            // cout << "YES" << endl;
        }
        else
        {
            // cout << "NO" << endl;
        }
    }

    return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main() {
	int n,m=0;
	cin>>n;
	priority_queue<pair<long long,pair<long long,long long>>,vector<pair<long long,pair<long long,long long>>>,greater<pair<long long,pair<long long,long long>>>> pq;
	long long x,y,z;
	pq.push({3,{2,1}});
	while(m<n){
	    x=pq.top().first;
	    y=pq.top().second.first,z=pq.top().second.second;
	    m++;
	    pq.pop();
	    if(y-z==1){
	        pq.push({2*y+1,{y+1,y}});
	    }
	    if(z>1){
	        pq.push({y*y-((z-1)*(z-1)),{y,z-1}});
	    }
	}
	cout<<x<<endl;
	return 0;
}

/*
    Author:- milind0110
*/
#include<bits/stdc++.h>
#pragma comment(linker, "/STACK:268435456");
using namespace std;
using namespace std::chrono;
#define vec vector<int>
#define vecp vector<pair<int,int>>
#define vecc vector<vector<int>>
#define pb push_back
#define fr first
#define sc second
#define fr1(i,a,b) for(int i = a; i < b; i++)
#define fr2(i,a,b) for(int i = a; i >= b; i--)
#define fr3(i,a,b) for(int i = a; i <= b; i++)
#define pr pair<int,int>
// #define mod 1000000007
// #define mod 998244353
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define ppb pop_back
#define lb lower_bound
#define ub upper_bound
#define popcnt __builtin_popcount
#define ary array
#define int long long

//reference :- tmwilliam168's template
template<class T> bool amin(T& a, const T& b) {
    return b < a ? a = b, 1 : 0;
}
template<class T> bool amax(T& a, const T& b) {
    return a < b ? a = b, 1 : 0;
}
template<class A> void read(vector<A>& v);
template<class A, size_t S> void read(ary<A, S>& a);
template<class T> void read(T& x) {
    cin >> x;
}
void read(double& d) {
    string t;
    read(t);
    d=stod(t);
}
void read(long double& d) {
    string t;
    read(t);
    d=stold(t);
}
void read(pair<int,int> &p){
    read(p.fr);
    read(p.sc);
}
template<class H, class... T> void read(H& h, T&... t) {
    read(h);
    read(t...);
}
template<class A> void read(vector<A>& x) {
    for(auto &a : x)
        read(a);
}
template<class A, size_t S> void read(array<A, S>& x) {
    for(auto &a : x)
        read(a);
}

string to_string(char c) {
    return string(1, c);
}
string to_string(bool b) {
    return b ? "true":"false";
}
string to_string(const char* s) {
    return string(s);
}
string to_string(string &s) {
    return s;
}
string to_string(vector<bool> &v) {
    string res;
    for(auto i:v)
        res += char('0'+i);
    return res;
}
template<class T> string to_string(T v) {
    bool f = 1;
    string res;
    for(auto &x : v) {
        if(!f)
            res += ' ';
        f = 0;
        res += to_string(x);
    }
    return res;
}

template<class A> void write(A x) {
    cout << to_string(x);
}
template<class H, class... T> void write(const H& h, const T&... t) {
    write(h);
    write(t...);
}
void print() {
    write("\n");
}
template<class H, class... T> void print(const H& h, const T&... t) {
    write(h);
    if(sizeof...(t))
        write(' ');
    print(t...);
}
void DBG() {
    cerr << "]" << endl;
}
template<class H, class... T> void DBG(H h, T... t) {
    cerr << to_string(h);
    if(sizeof...(t))
        cerr << ", ";
    DBG(t...);
}
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
const int INF = 1e9;
const int64_t INFF = 1e18;
const int N = 2e5 + 5;
//207215631
void solve(){
    int n;
    read(n);
    if(n <= 3){
        vec v = {3,5,7};
        print(v[n - 1]);
        return ;
    }
    int low = 3,high = 2e12;
    int ans = 0;
    while(low <= high){
        int mid = (low + high) / 2;
        //diff cant be more than root(N)
        int ind = mid - (mid/2 + 1)/2 - 1;
        if(ind <= n){
            ans = mid;
            low = mid + 1;
        } else {
            high = mid - 1;
        }
    }
    if(ans % 2 == 0 && ((ans/2) & 1)){
        ans--;
    }
    print(ans);
}
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    int t=1;
    // read(t);
    fr3(i,1,t){
        // cout<<"Case #"<<i<<":\n";
        solve();
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#define all(x) (x).begin(),(x).end()

#define int long long

int check(int x) {
    ll ans = 0;
    for(int k = 1; k <= 1e9; ++k) {
//        int cnt = max(0LL, b - 1 - max(0LL, (int) sqrt(b * b - m)));
        int l = 0, r = 3e9;
        while (r - l > 1) {
            int m = (l + r) / 2;
            if (k * k + 2LL * m * k < x) {
                l = m;
            }
            else {
                r = m;
            }
        }
        ans += l;
        if (l == 0) break;
    }

    return ans;
}

vector <int> temp;

int solve() {
    int n;
    cin >> n;

    int l = 3, r = 2e9;
    while(r - l > 1) {
        int m = (r + l) >> 1;
        if(check(m) < n)
            l = m;
        else
            r = m;
    }

//    if (l != temp[n - 1]) {
//        cout << n << '\n';
//        cout << l << " " << temp[n - 1];
//        return 1;
//    }
    cout << l;

    return 0;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    solve();
//
//    temp.reserve(1e6);
//    for (int b = 2; b < 1e3; ++b) {
//        for (int a = b - 1; a >= 1; --a) {
//            temp.push_back(b * b - a * a);
//        }
//    }
//    sort(all(temp));
//
//    for(int i = 3852; i < 3853; i++) {
//        if(solve(i))
//            break;
//    }
//    cerr << 1.0 * clock() / CLOCKS_PER_SEC << '\n';
    return 0;
}

#include<bits/stdc++.h>
#include<algorithm>

using namespace std;

double eps = 1e-7;

double check(double mid, double t[], double a[], int n)
{
    double range_lo = a[0] - (mid - t[0]);
    double range_hi = a[0] + (mid - t[0]);

    if (range_hi < range_lo)
        return -1;

    for (int i = 1; i < n; i++)
    {
        double lo = a[i] - (mid - t[i]);
        double hi = a[i] + (mid - t[i]);

        if (hi < lo)
            return -1;

        if (range_hi < lo)
            return -1;
        vector<double> v = {lo, hi, range_hi, range_lo};
        sort(v.begin(), v.end());

        range_lo = v[1];
        range_hi = v[2];
    }

    return range_hi;

}

int main()
{

    int t;
    cin >> t;
    //cout << fixed << setprecision(6) << eps << endl;

    while (t--)
    {
        int n;
        cin >> n;
        double t[n];
        double a[n];

        for (int i = 0; i < n; i++)
        {
            cin >> a[i];
        }
        for (int i = 0; i < n; i++)
        {
            cin >> t[i];
        }

        double hi = 3e8;
        double lo = 0;
        double LowestValidTime = 0;
        double x0 = lo;

        //cout << lo << " " << hi << endl;

        while (hi - lo >= eps)
        {
            double mid = (hi + lo) / 2;
            //cout << fixed << setprecision(6) << mid << " ";
            if (check(mid, t, a, n) != -1)
            {
                //cout << "y ";
                LowestValidTime = mid;
                hi = mid;
                x0 = check(mid, t, a, n);
            }
            else
            {
                lo = mid;
                //cout << "n ";
            }
        }
        //cout << endl << endl;

        //cout << LowestValidTime << endl;
        cout << fixed << setprecision(6) << x0 << endl;

    }

    return 0;
}

/**
 *    author:    tachithanhdanh
 *    created:   2022-09-04    20:50:49
**/

#include <bits/stdc++.h> // see /general/running-code-locally
using namespace std;

#ifdef LOCAL
#include "debugging.h"
#endif

#define endl "\n"

using ll = long long;
using str = string;

// vectors
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using vs = vector<str>;
#define all(x) begin(x), end(x)
#define sz(x) int(size(x))
#define pb push_back

// pairs
using pi = pair<int, int>;
using vpi = vector<pi>;
#define f first
#define s second
#define mp make_pair

// set min-max value.
template<typename T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; } // set a = min(a,b)
template<typename T> bool ckmax(T& a, const T& b) { return b > a ? a = b, 1 : 0; } // set a = max(a,b)

// constant initialization
const str yes="YES\n", no="NO\n";
const int MOD = 1e9 + 7; // 998244353
const int MX = 2e5 + 10;
const ll INF = 1e18; //Not too close to LLONG_MAX
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1}; // for every grid problem!!
const char dc[4] = {'r', 'u', 'l', 'd'};
const bool multitest = false;

void solve() {
	int N;
	cin >> N;
	cout << 2 * N + 1;
}

int main() {
	cin.tie(0)->sync_with_stdio(0); // see /general/fast-io
	#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	#endif // LOCAL
	int tt = 1;
	if (multitest) cin >> tt;
	for (int t = 0; t < tt; ++t) {
		solve();
	}
	return 0;
}

/* Includes */
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

/* Using libraries */
using namespace std;

/* Defines */
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ld long double
#define pb push_back
#define vc vector
#define sz(a) (int)a.size()
#define forn(i, n) for (int i = 0; i < n; ++i)
#define pii pair <int, int>
#define vec pt
#define all(a) a.begin(),a.end()
#define int long long

template <class T>
using pq = priority_queue<T, vc <T>, less <T>>;

template <class T>
using pqr = priority_queue<T, vc <T>, greater<T>>;

template <class T>
bool chmax (T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template <class T>
bool chmin (T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
#ifdef home
const int inf = 15;
const int N = 5;
#else
const int inf = 1e18;
const int N = 1e6;
#endif

void solve () {
    int n;
    cin >> n;
    int res = 0;
    vc <int> a;
    for (int x = 1; x <= N; ++x) {
        a.pb(x * x);
    }
    int s = sz(a);
    int l = 0, r = inf;
    while (r - l > 1) {
        int m = (l + r) / 2;
        int j = 0, col = 0;
        for (int i = 0; i < s; ++i) {
            while (j < i && a[i] - a[j] >= m) ++j;
            col += i - j;
        };
        if (col >= n) r = m;
        else l = m;
    }
    cout << l << '\n';
}

// 1 4 9 16 25

/* Starting and precalcing */
signed main() {
    /* freopen("input.txt","r",stdin);freopen("output.txt","w",stdout); */
    fast;
    int t = 1;
    // cin >> t;
    while (t--) solve();
}

#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

const ll mod  = 1e9 + 7;
const ld eps  = 1e-9 ;
const ll maxn = 1e5+1;
const ll inf  = 5e18 ;
const ll minf = -inf ;

#define mp make_pair
#define pb push_back
#define endl "\n"

ll check(ll n)
{
    ll ans = (n-1)/2;
    ans += n/4 - 1;
    return ans;
}

bool solve()
{
    ll n; cin>>n;
    ll low = 3, high = 1e9;
    ll ans;
    while(low < high)
    {
        ll mid = (low + high)/2;
        ll c = check(mid);
        if( c >= n)
        {
            ans = mid;
            high = mid-1;
        }
        else
        {
            low = mid+1;
        }
        // cout<<low<<" "<<high<<endl;
    }
    cout<<ans<<endl;
    return true;
}

int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    #ifdef NOW
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    freopen("error.txt","w",stderr);
    #endif
    ll t=1;
    // cin >> t;
    while(t--)
    {
        if(solve())
        {
            // cout << "YES" << endl;
        }
        else
        {
            // cout << "NO" << endl;
        }
    }

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n;
	long long ans=0;
	cin>>n;
	n+=2;
	if(n==1)
	{
		ans=3;
		return 0;
	}
	if(n%3==1)
		ans=4*(n/3)+1;
	if(n%3>1)
		ans=4*(n/3)+1+n%3;
	if(n%3==0)
		ans=4*(n/3);
	cout<<ans<<endl;
	return 0;
}
//2902690631@qq.com

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    long long l = 3, r = 10 * n;
    while (l < r)
    {
        long long mid = (l + r) >> 1;
        int cnt = (mid + 1) / 2 - 1 + max(0ll, mid / 4 - 1);
        if (cnt >= n)
            r = mid;
        else
            l = mid + 1;
    }
    cout << l << endl;
}

#include <bits/stdc++.h>
#define int long long
#define x first
#define y second
#define pb push_back
void debug() {std::cerr << "\n";}
template<class T, class... OtherArgs>
void debug(T &&var, OtherArgs &&... args) {
    std::cerr << std::forward<T>(var) << " ";
    debug(std::forward<OtherArgs>(args)...);
}
#define SZ(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
const int N = 500010, M = 2000010, P = 998244353;
LL powmod(LL a, LL b) {LL res = 1; a %= P; assert(b >= 0); for(; b; b >>= 1) { if (b & 1) res = res * a % P; a = a * a % P; } return res; }

int n, m;

void solve() {
    cin >> n;
    cout << n + 4;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int _ = 1;
    // cin >> _;
    while (_--) solve();
}

//clear adj and visited vector declared globally after each test case
//check for long long overflow
//Mod wale question mein last mein if dalo ie. Ans<0 then ans+=mod;
//Incase of close mle change language to c++17 or c++14
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define int long long
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);cout.precision(dbl::max_digits10);
#define pb push_back
#define mod 1000000007ll //998244353ll
#define lld long double
#define mii map<int, int>
#define pii pair<int, int>
#define ll long long
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=x; i<y; i++)
#define fill(a,b) memset(a, b, sizeof(a))
#define vi vector<int>
#define setbits(x) __builtin_popcountll(x)
#define print2d(dp,n,m) for(int i=0;i<=n;i++){for(int j=0;j<=m;j++)cout<<dp[i][j]<<" ";cout<<"\n";}
typedef std::numeric_limits< double > dbl;
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
//member functions :
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set
const long long N=200005, INF=2000000000000000000;
const int inf=2e9 + 5;
lld pi=3.1415926535897932;
int lcm(int a, int b)
{
    int g=__gcd(a, b);
    return a/g*b;
}
int power(int a, int b, int p)
    {
        if(a==0)
        return 0;
        int res=1;
        a%=p;
        while(b>0)
        {
            if(b&1)
            res=(1ll*res*a)%p;
            b>>=1;
            a=(1ll*a*a)%p;
        }
        return res;
    }
int cal(int n)
{
    int ans=(n-1)/2;
    if(n>4)
    ans+=(n-4)/4;
    return ans;
}
int32_t main()
{
    IOS;
    int n;
    cin>>n;
    int lb=3, ub=1e12, ans=ub;
    while(lb<=ub)
    {
        int md=(lb+ub)/2;
        // cout<<md<<" "<<cal(md)<<'\n';
        if(cal(md)<=n)
        {
            ans=min(md, ans);
            lb=md+1;
        }
        else
        ub=md-1;
    }
    cout<<ans;
}

#include <bits/stdc++.h>
using namespace std;

typedef long long           ll;
typedef unsigned long long  ull;
typedef long double         ld;

//#define int                 long long
#define endl                '\n'
#define gap                 ' '
#define dbg(x)              cout<<#x<<" = "<<x<<'\n'
#define print(b)            for(auto &a:b) cout<<a<<' ';
#define printN(b)           for(auto &a:b) cout<<a<<endl;
#define ALL(r)              (r).begin(),(r).end()
#define FASTIO              ios::sync_with_stdio(false);cin.tie(NULL);
#define popcount            __builtin_popcount
#define popcountll          __builtin_popcountll
#define clz                 __builtin_clz
#define ffs                 __builtin_ffs

void solve() {
    int n;
    cin >> n;
    int ans;
    if (n == 1)
        ans = 3;
    else if (n == 2)
        ans = 5;
    else if (n == 3)
        ans = 7;
    else {
        int dif = n - 3;
        int cur = (dif / 4);
        ans = 7 + dif;
        if (ans % 2 == 0 and ans % 4 != 0)
            cur++;
        while (cur) {
            int tem = ans;
            ans += cur;
            cur = (ans - tem) / 4;
            if (ans % 2 == 0 and ans % 4 != 0)
                cur++;
        }
        if (!(ans & 1))
            (ans % 4) ? ans++ : ans;
    }
    cout << ans << endl;
}

signed main() {
    FASTIO

    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#define all(x) (x).begin(),(x).end()

#define int long long

int check(int m) {
    ll ans = 0;
    for(int b = 2; b <= 1e6; ++b) {
        int cnt = max(0LL, b - 1 - max(0LL, (int) sqrt(b * b - m)));
        ans += cnt;
    }

    return ans;
}

void solve() {
    int n; cin >> n, --n;

    int l = 0, r = 1e12 + 100;
    while(r - l > 1) {
        int m = (r + l) >> 1;
//        cerr << m << ' ' << check(m) << '\n';
        if(check(m) <= n)
            l = m;
        else
            r = m;
    }

    cout << l;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    solve();
    cerr << 1.0 * clock() / CLOCKS_PER_SEC << '\n';
    return 0;
}

#include<bits/stdc++.h>
#include<vector>

using namespace std;

#define vin vector<int>
#define pin pair<int,int>
#define pb push_back
#define ll long long

const ll MOD=1e9+7;

int main(){
	int t=1;//cin>>t;
	while(t--){
		ll n;cin>>n;
		cout<<(n+1)*(n+1)-n*n<<endl;
	}
}

#include <bits/stdc++.h>
# include <string>
# include <math.h>
using namespace std;
typedef long long int ll;
typedef vector<vector<int>> graph;
typedef vector<int> vi;
typedef pair<int,int> pi;
#define F first
#define S second
#define PB push_back
#define MP make_pair

int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);

    ll n ; cin >> n ;

    ll ans ;

    if(n == 1) ans =4;
    if(n ==2) ans = 5;
    if( n == 3) ans = 7 ;
    else{

        if((n-1)%3 == 0) ans =4*((n-1)/3)+4;
        else if((n-1)%3 == 1) ans = 4*((n-1)/3)+4+1;
        else ans = 4*((n-1)/3)+4+3;

    }

    cout << ans << endl;

}

#include<bits/stdc++.h>
using namespace std;

#define ll long long

bool solve(){
    int n;
    cin >> n;

    int max = 6;
    int count = 0;
    for(int i = 3;i<=n;++i){
        while(count != 3){
            max++;
            count++;
        }
        count = 0;
        max++;
    }

    if(n % 3 == 2)
    cout << max/3 +3  << endl;
    else cout << max/3 + 4<<endl;

  }

int main(){
    ios_base::sync_with_stdio(false);

    solve();

}

// hare krishna hare krishna krishna krishna hare hare
// hare ram hare ram ram ram hare hare
#include <iostream>
#include <vector>
#include <set>
#include <climits>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <stack>
#include <bitset>
#include <stdio.h>
#include <list>
#include <deque>
#define Code ios_base::sync_with_stdio(false);
#define By cin.tie(NULL);
#define Nikhil cout.tie(NULL);
using namespace std;
typedef long long ll;
#define int long long
#define vi vector<int>
#define vii vector<vector<int>>
#define vl vector<ll>
#define vpi vector<pair<int, int>>
#define M  998244353
#define pi pair<int, int>
#define M_P 3.14159265358979323846
#define inf 1e18
template <class T>
T expo(T base, T exp, T mod)
{
  T res = 1;
  base = base % mod;
  while (exp > 0)
  {
    if (exp & 1)
      res = (res * base) % mod;
    exp = exp >> 1;
    base = (base * base) % mod;
  }
  return res;
}
void input(vi &arr)
{
  for (int i = 0; i < arr.size(); i++)
    cin >> arr[i];
}
void output(vi &arr)
{
  for (int i = 0; i < arr.size(); i++)
    cout << arr[i] << " ";
  cout << endl;
}
int gcd(int a, int b)
{
  if (a == 0)
    return b;
  return gcd(b % a, a);
}
// vector<bool> prime((int)1e8 + 2, true);
// void SieveOfEratosthenes(int n)
// {
//     prime[1] = false;
//     for (int p = 2; p * p <= n; p++)
//     {
//         if (prime[p] == true)
//         {
//             for (int i = p * p; i <= n; i += p)
//                 prime[i] = false;
//         }
//     }
// }
// int parent(vi &par,int u)
// {
//   if(par[u] == u) return u;
//   return par[u] = parent(par,par[u]);

// }
// ncr values calculator;
// vector<int>fac(62);
// vector<int>ifac(62);
// void preprocess()
// {
//   fac[0] = 1;
//   fac[1] = 1;
//   for(int i = 2;i<=60;i++)
//   {
//     fac[i] = (fac[i-1]* i)%M;
//   }
//   int m = 998244353;
//   int val = expo(fac[60],m-2,m);
//   ifac[60] = val;

//   for(int i = 60-1;i>=0;i--)
//   {
//     ifac[i] = ((i+1) * ifac[i+1])%M;
//   }
// }
//===========================================================================
pair<int,int> cal(int t,vi &xc,vi &ti){
  pair<int,int>rn = {-1,-1};
  for(int i = 0;i<xc.size();i++){
    if(ti[i] > t) return {-1,-1};
    else {
      pair<int,int>c = {xc[i]-(t-ti[i]),xc[i]+(t-ti[i])};
      if(rn.first == -1 && rn.second == -1) rn = c;
      else{
        int f = max(rn.first,c.first);
        int s = min(rn.second,c.second);

        if(f > s) return {-1,-1};
        rn = {f,s};
      }
    }
  }

  return rn;

}
void solve(){
  int n; cin>>n;
  int l = 3;
  int r = 10000000000;

  while(l <= r){
    int mid = (l+r)/2;
    int o = 0;
    int m4 = 0;
    int k = mid-1;
    o = (k-1)/2-1;
    m4 = k/4;;
    if(m4 > 1) m4--;
    int s = o+m4;
    if(s > n){
      r = mid-1;
    }
    else if(s+1 == n){
      if(mid%4 == 0 || mid%2!=0) cout<<mid<<"\n";
      else cout<<mid+1<<"\n";
      return ;
    }
    else if(s+1 == n){
      r = mid-1;
    }
    else l = mid+1;
  }
}
int32_t main()
{
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  Code By Nikhil int t;
  //cin >> t;
  t = 1;
  // SieveOfEratosthenes(1e7);
  while (t--)
  {
    solve();
  }
}

#include <bits/stdc++.h>
using namespace std;

int main(){
    int N; cin >> N;
    int counter = 0, ans = 3;
    while (counter != N){
        ans += 2;
        counter++;
    }
    cout << ans << endl;
}

#include <bits/stdc++.h>
//tle
using ll = long long;

const long long N = 2e5 + 10, M = 28, P = 998244353, inf = (1ll << 60) - 1;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef std::pair<ll, ll> PII;
typedef std::pair<int, double> PID;
typedef std::pair<double, double> PDD;
#define endl '\n'
#define x first
#define y second
#define db long double
//#define db double
#define VI std::vector
#define lg2(x) log2(x)
#define PI acosl(-1)
#define mp(x, y) std::make_pair(x, y)
#define debug(c, a) std::cout << c << " : " << a << endl;
#define pb(x) push_back(x)
#define bt(x) (1 << (x))
#define sz(x) (int) (x.size())
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define Rep(i, a, b) for (int i = a; i < b; i++)
#define su(i, a, b) for (ll i = b; i >= a; i--)
#define all(x) x.begin() + 1, x.end()
#define pt(x) std::cout << std::fixed << std::setprecision(5) << x << " \n";
std::mt19937_64 mrnd(std::random_device{}());
ll n;
ll dp[2010][2010];
//std::bitset<1000000000> f;
void solve() {
    ll res = 0;
    ll l = 1, r = 1e18,y;
    std::cin >> y;
    while (l < r){
        ll mid = l + r >> 1;
        auto ck = [&](ll x){
            return (x / 4 - 1 + (x + 1)/ 2 - 1) >= y;
        };
       // std::cout << l << " " << r << endl;
        if (ck(mid))
            r = mid;
        else
            l = mid + 1;
    }
    std::cout << r << endl;
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int _ = 1;
  //  std::cin >> _;
    while (_--) {
        solve();
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
void solve() {
    ll n; cin >> n;
    if (n > 100000) while (true) {};
    ll l = 0, r = 100000000000000;
    function<bool(ll)> check = [&] (ll mid) {
        ll tot = 0;
        for (ll i = 1; i <= 10000000; ++i) {
            ll j = mid / i;
            if (j <= i) break;
            tot += (j - i) / 2;
        }
        return tot >= n;
    };
    while (l < r) {
        ll mid = (l + r) >> 1;
        if (check(mid)) r = mid;
        else l = mid + 1;
    }
    cout << l << "\n";
}

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    solve();
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll count(int K, vector<ll>& nums) {
    int cnt = 0, l = 0, n = nums.size();
    for (int r = 0; r < n; ++r) {
        while (l < r && nums[r] - nums[l] > K) {
            l++;
        }
        cnt += r - l;
    }
    return cnt;
}
ll smallestDistancePair(vector<ll>& nums, int k) {
    int n = nums.size();
    sort(nums.begin(), nums.end());
    int l = 0, r = nums[n - 1] - nums[0];
    while (l < r) {
        int m = (l + r) / 2;
        if (count(m, nums) >= k) r = m;
        else l = m + 1;
    }
    return l;
}

int main() {
	vector<ll> vx;
    for (ll i = 1; i <= 2000000; i++)vx.push_back(i * i);
    ll n;
    cin >> n;
    cout << smallestDistancePair(vx, n);
}