#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
const i64 MOD = 1e9 + 7;
const i64 INF = 1e18 + 7;
signed main() {
  vector<int> aa;
  vector<int> bb(16003, -1);
  bb[0] = 0;
  bb[1] = 1;
  function<int(int)> f = [&](int x) {
    if (bb[x] != -1) return bb[x];
    if (x & 1)
      return bb[x] = f(x / 2) + f(x / 2 + 1);
    else
      return bb[x] = f(x / 2);
  };
  for (int i = 0; i < 16003; ++i) f(i);
  vector<int> c(1, 0);
  for (auto& x : bb) c.emplace_back((c.back() + x) % MOD);
  i64 n;
  cin >> n;
  cout << c[n + 2] << endl;
}
