#include <bits/stdc++.h>
using namespace std;
int chh;
const int N = 100005;
const long long INF = 10000000005;
struct Node {
  int x0, y0;
  int x1, y1;
  int dx, dy;
  long long val;
  void print() {
    printf("x0=%d y0=%d\nx1=%d y1=%d\ndx=%d dy=%d\nval=%I64d\n", x0, y0, x1, y1,
           dx, dy, val);
    system("pause");
  }
  Node() {}
  Node(int A, int B, int C, int D, int E, int F, long long G)
      : x0(A), y0(B), x1(C), y1(D), dx(E), dy(F), val(G) {}
} p[N * 4];
int n, m, k;
int kx[4] = {1, 1, -1, -1};
int ky[4] = {1, -1, 1, -1};
void gao(int x, int y, int dx, int dy, int &u, int &v) {
  int t;
  if (dx == 1 && dy == 1) {
    t = min(n - x, m - y);
    u = x + t, v = y + t;
  }
  if (dx == -1 && dy == 1) {
    t = min(x, m - y);
    u = x - t, v = y + t;
  }
  if (dx == 1 && dy == -1) {
    t = min(n - x, y);
    u = x + t, v = y - t;
  }
  if (dx == -1 && dy == -1) {
    t = min(x, y);
    u = x - t, v = y - t;
  }
}
int getId(int x, int y) {
  if (x == 0) return y;
  if (y == m) return m + x;
  if (x == n) return n + m + m - y;
  return m + n + m + n - x;
}
long long find(int id, int x, int y) {
  if ((long long)(x - p[id].x0) * (x - p[id].x1) > 0) return INF;
  if ((long long)(y - p[id].y0) * (y - p[id].y1) > 0) return INF;
  if (abs(x - p[id].x0) != abs(y - p[id].y0)) return INF;
  return abs(x - p[id].x0) + p[id].val;
}
int main() {
  int x0, y0, x1, y1, dx, dy;
  int x, y, id, pre;
  long long val;
  while (~scanf("%d %d %d", &n, &m, &k)) {
    memset(p, -1, sizeof(p));
    x0 = 0, y0 = 0, dx = 1, dy = 1;
    gao(x0, y0, dx, dy, x1, y1);
    pre = id = getId(x0, y0);
    p[id] = Node(x0, y0, x1, y1, dx, dy, 0);
    while (1) {
      x0 = p[pre].x1, y0 = p[pre].y1;
      dx = p[pre].dx, dy = p[pre].dy;
      val = abs(p[pre].x1 - p[pre].x0) + p[pre].val;
      if (x0 == 0 && y0 == 0) break;
      if (x0 == 0 && y0 == m) break;
      if (x0 == n && y0 == 0) break;
      if (x0 == n && y0 == m) break;
      if (x0 == 0 || x0 == n)
        dx = dx * (-1);
      else
        dy = dy * (-1);
      gao(x0, y0, dx, dy, x1, y1);
      pre = id = getId(x0, y0);
      p[id] = Node(x0, y0, x1, y1, dx, dy, val);
    }
    for (int i = 0; i < (k); i++) {
      scanf("%d %d", &x0, &y0);
      val = INF;
      for (int j = 0; j < (4); j++) {
        gao(x0, y0, kx[j], ky[j], x, y);
        id = getId(x, y);
        if (p[id].val != -1) {
          val = min(val, find(id, x0, y0));
        }
      }
      if (val == INF) val = -1;
      printf("%I64d\n", val);
    }
  }
  return 0;
}
