#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int mod = pow(10, 9) + 7;
  long long int n;
  cin >> n;
  vector<long long int> a(n + 5);
  a[0] = 0;
  a[1] = 1;
  for (long long int i = 2; i < n + 5; i++) {
    if (i % 2 == 0) {
      a[i] = a[i / 2];
    } else {
      long long int x = (i - 1) / 2;
      a[i] = a[x] + a[x + 1];
    }
  }
  long long int res = 0;
  for (long long int i = 0; i < (n + 1); i++) {
    res += a[i + 1];
    res %= mod;
  }
  cout << res << endl;
  return 0;
}
