In 20XX, an efficient material transfer method was established for distant places, and human beings' advance into space was accelerated more and more. This transfer method was innovative in that, in principle, larger substances could be transferred when trying to transfer the substance farther. The details of the transfer method are described below.

First, the substance to be transferred is divided into particles for each unit mass at the start coordinates (1, 1). Each particle must be given a different wave energy. Wave energy is represented by a character string of arbitrary length consisting of V and H, and defines how particles drift in outer space. V means the movement on the coordinates (+1, 0), and H means the movement of (0, +1). For example, a particle given wave energy called VHHV drifts in the universe on the trajectories (2, 1), (2, 2), (2, 3) and then reaches the coordinates (3, 3).

In addition, there are multiple warp holes in outer space, which affect the trajectory of particles. The warp hole has an entrance and an exit, and when a particle moves to the entrance of the warp hole, it always warps to the coordinates of the exit. If the coordinates of the entrance and exit of the i-th warp hole are (ai, bi), (ci, di), the condition ai ≤ ci, bi ≤ di, (ai, bi) ≠ (ci, di) is satisfied. It is guaranteed that the entrance to the warp hole does not exist at the same coordinates as the entrance to other warp holes or at (1, 1). However, there may be multiple exits in the same location, or one warp hole exit may have another warp hole entrance (in this case, warp consecutively).

For example, if there is a warp hole with (1, 2) as the inlet and (3, 2) as the exit, the particles given HH and wave energy move to (1, 2) and then (3, 2). Warp to 2) and reach (3, 3).

When particles are given wave energy, they move according to it in an instant. When all the particles reach the destination at the same time, they are automatically reconstructed into the original substance.

You are a programmer of Japan Aerospace Exploration Agency. Since the target coordinates (N, M) of the transfer and the coordinate pairs of K warp holes are given, please write a program to find the maximum mass of the substance that can be transferred at one time. The answer can be very large, so print the remainder divided by 1,000,000,007.

Notes on Test Cases

Multiple datasets are given in the above input format. Create a program that outputs each data set in the above output format.

When N, M, K are all 0, it indicates the end of input.

<!-



Input


NMK
a1 b1 c1 d1
...
aK bK cK dK

Satisfy 1 ≤ N, M ≤ 105, 0 ≤ K ≤ 103. Also, for any 1 ≤ i ≤ K, ai ≤ ci, bi ≤ di, (ai, bi) ≠ (ci, di) is satisfied.

Output

Divide the maximum mass by 1,000,000,007 and output the remainder in one line.

Examples

Input

4 4 1
2 2 3 3
1 4 1
1 2 1 3
5 5 2
2 2 3 4
3 3 5 3
5 5 3
4 4 5 5
2 2 3 3
3 3 4 4
100000 100000 1
2 2 99999 99999
1 1 0
0 0 0


Output

12
1
26
18
615667476
1


Input

4 4 1
2 2 3 3


Output

12


Input

1 4 1
1 2 1 3


Output

1


Input

5 5 2
2 2 3 4
3 3 5 3


Output

26


Input

5 5 3
4 4 5 5
2 2 3 3
3 3 4 4


Output

18


Input

100000 100000 1
2 2 99999 99999


Output

615667476


Input

1 1 0


Output

1
/*
 * AOJ 2214: Warp Hall
 * ?¢??????????(1,1)?????°??????(m,n)???????¬??????????????????°?????????????????°????´???????????????´??\??°???????????????????´????????????????????°??§??????????
 * ?±????????????°DP
 * ???????????????????´?i(ai,bi)??°(ci,di)???(1,1)??°(ai,bi)???????????°???di??????????????\????´???????????????¢????????????????????????????????£???L??????????????????di????°?????´??????????DP?±???°?????°??????????´???\??£???????????°???
 */


#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

typedef long long LL;

const LL MOD = 1000000007ll;

inline LL add(LL a, LL b) { return (a + b) % MOD; }

inline LL sub(LL a, LL b) { return (a - b + MOD) % MOD; }

inline LL mul(LL a, LL b) { return a * b % MOD; }

LL f[200010];

LL Inverse(LL a, LL p = MOD) {
  if (a == 1) return 1;
  return sub(0, mul(p / a, Inverse(p % a, p)));
}

LL C(LL a, LL b) {
  return mul(mul(f[a], Inverse(f[b])), Inverse(f[a - b]));
}

struct Warp {
  int sx, sy, tx, ty;

  bool operator<(const Warp &w) const {
    if (sx != w.sx) return sx < w.sx;
    return sy < w.sy;
  }
} w[1010];

LL d[1010];
int m, n, k;

LL Gao(LL sx, LL sy, LL tx, LL ty) {
  if (sx > tx || sy > ty) return 0;
//  printf("%lld %lld %lld %lld\n", sx, sy, tx, ty);
  return C(tx - sx + ty - sy, tx - sx);
}

int main() {
  f[0] = 1;
  for (LL i = 1; i <= 200000; ++i) {
    f[i] = mul(f[i - 1], i);
  }
  while (scanf("%d%d%d", &m, &n, &k) != EOF && m + n + k > 0) {
    for (int i = 0; i < k; ++i) {
      scanf("%d%d%d%d", &w[i].sx, &w[i].sy, &w[i].tx, &w[i].ty);
      --w[i].sx;
      --w[i].sy;
      --w[i].tx;
      --w[i].ty;
    }
    memset(d, 0, sizeof(d));
    sort(w, w + k);
    w[k].sx = m - 1;
    w[k].sy = n - 1;
    for (int i = 0; i <= k; ++i) {
      d[i] = C(w[i].sx + w[i].sy, w[i].sx);
//      printf("%d %lld\n", i, d[i]);
      for (int j = 0; j < i; ++j) {
//        printf("--%d %d\n", i, j);
        d[i] = add(d[i],
                   mul(d[j],
                       sub(Gao(w[j].tx, w[j].ty, w[i].sx, w[i].sy),
                           Gao(w[j].sx, w[j].sy, w[i].sx, w[i].sy))));
//        printf("--%d %d\n", i, j);
      }
//      printf("%d %lld\n", i, d[i]);
    }
    printf("%lld\n", d[k]);
  }

  return 0;
}