#include <bits/stdc++.h>
using namespace std;
const int M = 300005, N = 550;
vector<pair<int, int> > le[N];
vector<pair<int, pair<int, int> > > gr;
int w[M];
int n;
long long ans[M], pre[M];
void solve_greater() {
  for (int i = 0; i < gr.size(); i++) {
    int id = gr[i].first, a = gr[i].second.first, b = gr[i].second.second;
    while (a < n) {
      ans[id] += w[a];
      a += b;
    }
  }
}
void solve_less() {
  for (int i = 0; i < N; i++) {
    for (int j = n - 1; j >= 0; j--) {
      pre[j] = w[j];
      if (j + i >= n) continue;
      pre[j] += pre[j + i];
    }
    for (int j = 0; j < le[i].size(); j++)
      ans[le[i][j].second] = pre[le[i][j].first];
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &w[i]);
  int q;
  scanf("%d", &q);
  for (int i = 0; i < q; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    a--;
    if (b >= N) {
      gr.push_back(make_pair(i, make_pair(a, b)));
    } else {
      le[b].push_back(make_pair(a, i));
    }
  }
  solve_greater();
  solve_less();
  for (int i = 0; i < q; i++) printf("%I64d\n", ans[i]);
  return 0;
}
