#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long int sumXOR(long long arr[], int n) {
  long long int sum = 0;
  for (int i = 0; i < 64; i++) {
    long long zc = 0, oc = 0;
    long long int idsum = 0;
    for (int j = 0; j < n; j++) {
      if (arr[j] % 2 == 0)
        zc++;
      else
        oc++;
      arr[j] /= 2;
    }
    idsum = (oc * zc) % mod;
    idsum *= (1LL << i);
    idsum %= mod;
    sum += idsum;
    if (sum >= mod) sum -= mod;
  }
  return sum;
}
int main() {
  long long int sum = 0;
  long long arr[] = {3,      14,      159,      2653,      58979,
                     323846, 2643383, 27950288, 419716939, 9375105820};
  int n = sizeof(arr) / sizeof(arr[0]);
  sum = sumXOR(arr, n);
  cout << sum;
  return 0;
}
