#include <bits/stdc++.h>
const int SQRT_BORDER = 300;
using namespace std;
int main() {
  int n, a, b, p;
  long long w, cur_sum, cur_q;
  vector<long long> data;
  vector<vector<long long> > weights;
  vector<map<int, long long> > questions;
  map<int, long long>::iterator it;
  vector<pair<int, int> > order_questions;
  scanf("%d", &n);
  weights.assign(n, vector<long long>());
  data.assign(n, 0);
  for (int i = 0; i < n; ++i) {
    cin >> w;
    weights[i].push_back(w);
    data[i] = w;
  }
  scanf("%d", &p);
  questions.assign(n, map<int, long long>());
  for (int i = 0; i < p; ++i) {
    cin >> a >> b;
    --a;
    order_questions.push_back(make_pair(a, b));
    if (b <= SQRT_BORDER) questions[a][b] = 0;
  }
  weights[n - 1].resize(SQRT_BORDER + 1, weights[n - 1][0]);
  for (int i = n - 1; i >= 0; --i) {
    for (int j = 1; j <= SQRT_BORDER; ++j) {
      if (i - j >= 0) {
        if (weights[i - j].size() < SQRT_BORDER + 1) {
          weights[i - j].resize(SQRT_BORDER + 1, weights[i - j][0]);
        }
        weights[i - j][j] += weights[i][j];
      } else {
        break;
      }
    }
    if (questions[i].size() != 0) {
      for (it = questions[i].begin(); it != questions[i].end(); ++it) {
        if ((*it).first <= SQRT_BORDER) (*it).second = weights[i][(*it).first];
      }
    }
    vector<long long>().swap(weights[i]);
  }
  for (int i = 0; i < p; ++i) {
    a = order_questions[i].first;
    b = order_questions[i].second;
    if (b <= SQRT_BORDER) {
      cout << questions[a][b] << endl;
    } else {
      cur_sum = 0;
      for (int i = a; i < n; i += b) {
        cur_sum += data[i];
      }
      cout << cur_sum << endl;
    }
  }
  return 0;
}
