#include <bits/stdc++.h>
using namespace std;
struct node {
  int a, b, id;
  bool operator<(const node& x) const { return b < x.b; }
} q[300010];
int n;
long long s[300010];
long long c[300010];
long long ans[300010];
void init() {
  while (~scanf("%d", &n)) {
    for (int i = 0; i < n; ++i) scanf("%I64d", c + i);
    int Q;
    scanf("%d", &Q);
    for (int i = 0; i < Q; ++i) {
      scanf("%d%d", &q[i].a, &q[i].b);
      q[i].id = i;
    }
    sort(q, q + Q);
    int ii, jj;
    for (ii = jj = 0; ii < Q && q[ii].b < 600; ii = jj) {
      while (jj < Q && q[ii].b == q[jj].b) ++jj;
      for (int k = n - 1; k >= 0; --k) {
        if (k + q[ii].b < n)
          s[k] = c[k] + s[k + q[ii].b];
        else
          s[k] = c[k];
      }
      for (int k = ii; k < jj; ++k) ans[q[k].id] = s[q[k].a - 1];
    }
    while (ii < Q) {
      long long tmp = 0;
      for (int k = q[ii].a - 1; k < n; k += q[ii].b) tmp += c[k];
      ans[q[ii++].id] = tmp;
    }
    for (int i = 0; i < Q; ++i) printf("%I64d\n", ans[i]);
  }
}
int main() {
  init();
  return 0;
}
