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

using num = vector<int>;

const num ZERO{0}, ONE{1};

num to_num(string s)
{ int n = s.size();
  num a(n);
  for(int i=0,j=n-1; i<n; i++,j--)
    a[i] = s[j] - '0';
  return a;
}

string to_string(num a)
{ int n = a.size();
  string s(n,'0');
  for(int i=0,j=n-1; i<n; i++,j--)
    s[i] += a[j];
  return s;
}

istream& operator>>(istream& cin, num& a)
{ string s; cin >> s;
  a = to_num(s);
  return cin;
}

ostream& operator<<(ostream& cout, const num& a)
{ cout << to_string(a);
  return cout;
}

num add(num a, num b)
{ while(a.size() < b.size()) a.push_back(0);
  while(b.size() < a.size()) b.push_back(0);

  int n = a.size();
  num x(n);
  int c = 0;
  for(int i=0; i<n; i++)
  { x[i] = a[i] + b[i] + c;
    c = x[i] / 10;
    x[i] = x[i] % 10;
  }
  while(c>0)
  { x.push_back(c%10);
    c = c/10;
  }
  return x;
}

num sub(num a, num b)
// suppose a>=b
{ int n = a.size();
  while(b.size()<n) b.push_back(0);
  while(b.size()>n) b.pop_back();

  num x(n);
  int c = 0;
  for(int i=0; i<n; i++)
  { x[i] = a[i] - b[i] - c;
    if(x[i]>=0) c=0;
    else
    { c=1; x[i] += 10; }
  }
  while(x.size()>1 and x.back()==0) x.pop_back();
  return x;
}

num mul(num a, num b)
{ int m = a.size();
  int n = b.size();
  num x(m+n);
  for(int i=0; i<m; i++)
    for(int j=0; j<n; j++)
      x[i+j] = x[i+j] + a[i]*b[j];
  int c = 0;
  for(int i=0; i<m+n; i++)
  { x[i] = x[i] + c;
    c = x[i] / 10;
    x[i] = x[i] % 10;
  }
  while(c>0)
  { x.push_back(c%10);
    c = c / 10;
  }
  while(x.size()>1 and x.back()==0)
    x.pop_back();
  return x;
}

num operator+(num a, num b)
{ return add(a,b); }

num operator-(num a, num b)
{ return sub(a,b); }

num operator*(num a, num b)
{ return mul(a,b); }


pair<num,int> divmod(num a, int x)
{ if(x==1) return pair<num,int>{a,0};

  int n=a.size();
  num b(n);
  int p=0;
  for(int i=n-1; i>=0; i--)
  { p = p*10 + a[i];
    b[i] = p/x;
    p = p % x;
  }
  while(b.size()>1 and b.back()==0) b.pop_back();
  return pair<num,int>{b,p};
}

num operator/(num a, int x)
{ return divmod(a,x).first; }

int operator%(num a, int x)
{ return divmod(a,x).second; }

bool operator<=(num a, num b)
{ while(a.size() < b.size()) a.push_back(0);
  while(b.size() < a.size()) b.push_back(0);
  return to_string(a) <= to_string(b);
}

num div(num b, num a)
{ num x = ZERO;
  num y = b+ONE;

  while(y-x != ONE)
  { num m = x+(y-x)/2;
    num s = a*m;
    if(s<=b) x = m;
    else y = m;
  }
  return x;
}

num operator/(num a, num b)
{ return div(a,b); }

num operator%(num a, num b)
{ num q = div(a,b);
  num r = a - b*q;
  return r;
}

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

  vector<num> a(1001);
  for(int i=1; i<=4; i++)
    a[i]=to_num(to_string(i));
  for(int i=5; i<=n; i++)
    a[i]=a[i-3]+a[i-1];

  cout << a[n] << endl;

  return 0;
}
