#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

//-------------------------------------------------
//--Matrix
//-------------------------------------------------
template<typename T>
class Matrix
{
private:
    using V = ::std::vector<T>;
    using M = ::std::vector<V>;
    M dat;
    int h,w;
public:
    Matrix(int h_, int w_):h(h_),w(w_){
        dat.resize(h,V(w));
    }
    Matrix(const M &mat){
        h = mat.size();
        w = mat[0].size();
        dat.resize(h,V(w));
        for(int i=0; i<h; i++)
            for(int j=0; j<w; j++)
                dat[i][j]=mat[i][j];
    }
    Matrix(const Matrix &m){
        h = m.h; w = m.w;
        dat.resize(h,V(w));
        for(int i=0; i<h; i++)
            for(int j=0; j<w; j++)
                dat[i][j]=m.dat[i][j];
    }
    static Matrix getI(int n){
        Matrix ret(n,n);
        for(int i=0;i<n;i++) ret[i][i] = 1;
        return ret;
    }
    Matrix& operator+=(const Matrix &m){
        assert(m.h==h && m.w==w);
        for(int i=0; i<h; i++)
            for(int j=0; j<w; j++)
                dat[i][j]+=m.dat[i][j];
        return *this;
    }
    Matrix& operator-=(const Matrix &m){
        assert(m.h==h && m.w==w);
        for(int i=0; i<h; i++)
            for(int j=0; j<w; j++)
                dat[i][j]-=m.dat[i][j];
        return *this;
    }
    Matrix& operator*=(const Matrix &m){
        assert(m.h==w);
        M ret(h, V(m.w));
        for(int i=0; i<h; i++)
            for(int j=0; j<m.w; j++)
                for(int k=0; k<w; k++)
                    ret[i][j]+=dat[i][k]*m.dat[k][j];
        dat.swap(ret);
        return *this;
    }
    Matrix& operator*=(T c){
        for(int i=0; i<h; i++)
            for(int j=0; j<w; j++)
                dat[i][j]*=c;
        return *this;
    }
    Matrix& operator^=(::std::uint_fast64_t t){
        assert(h==w);
        Matrix ret = Matrix::getI(h);
        Matrix m(*this);
        while(t){
            if (t&1) ret*=m;
            m*=m;
            t>>=1;
        }
        dat.swap(ret.dat);
        return *this;
    }
    Matrix operator+(const Matrix &m) const {return Matrix(*this)+=m;}
    Matrix operator-(const Matrix &m) const {return Matrix(*this)-=m;}
    Matrix operator*(const Matrix &m) const {return Matrix(*this)*=m;}
    Matrix operator*(T c) const {return Matrix(*this)*=c;}
    Matrix operator^(::std::uint_fast64_t t) const {return Matrix(*this)^=t;}
    Matrix operator-() const {return Matrix(*this)*=-1;}
    V& operator[](int h){return dat[h];}
};

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    Matrix<ll> vec(2,1);
    vec[0][0]=1; vec[1][0]=2;
    Matrix<ll> A(2,2);
    A[0][0]=A[0][1]=A[1][0]=1;
    A^=n-1;
    vec=A*vec;
    cout<<vec[0][0]<<endl;
    return 0;
}


Measured memory_bytes: 256