#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  vector<long long> h(n + 1);
  h[0] = 1;
  for (long long i = 1; i <= n; i++) {
    if (i % 2 == 0)
      h[i] = (h[i / 2] + h[i / 2 - 1]) % ((long)1e9 + 7);
    else
      h[i] = h[i / 2] % ((long)1e9 + 7);
  }
  long long ans = 0;
  for (long long i = 0; i <= n; i++) ans = (ans + h[i]) % ((long)1e9 + 7);
  cout << ans << endl;
  return 0;
}
