Problem: <!--

Problem H

-->

Addition on Convex Polygons

Mr. Convexman likes convex polygons very much. During his study on convex polygons, he has come up with the following elegant addition on convex polygons.

The sum of two points in the xy-plane, (x1, y1) and (x2, y2) is defined as (x1 + x2, y1 + y2). A polygon is treated as the set of all the points on its boundary and in its inside. Here, the sum of two polygons S1 and S2, S1 + S2, is defined as the set of all the points v1 + v2 satisfying v1 ∈ S1 and v2 ∈ S2. Sums of two convex polygons, thus defined, are always convex polygons! The multiplication of a non-negative integer and a polygon is defined inductively by 0S = {(0, 0)} and, for a positive integer k, kS = (k - 1)S + S. In this problem, line segments and points are also considered as convex polygons.

<image>

Mr. Convexman made many convex polygons based on two convex polygons P and Q to study properties of the addition, but one day, he threw away by mistake the piece of paper on which he had written down the vertex positions of the two polygons and the calculation process. What remains at hand are only the vertex positions of two convex polygons R and S that are represented as linear combinations of P and Q with non-negative integer coefficients:

> R = aP + bQ, and
>  S = cP + dQ.

Fortunately, he remembers that the coordinates of all vertices of P and Q are integers and the coefficients a, b, c and d satisfy ad - bc = 1.

Mr. Convexman has requested you, a programmer and his friend, to make a program to recover P and Q from R and S, that is, he wants you to, for given convex polygons R and S, compute non-negative integers a, b, c, d (ad - bc = 1) and two convex polygons P and Q with vertices on integer points satisfying the above equation. The equation may have many solutions. Make a program to compute the minimum possible sum of the areas of P and Q satisfying the equation.

Input

The input consists of at most 40 datasets, each in the following format.

> n m
>  x1 y1
>  ...
>  xn yn
>  x'1 y'1
>  ...
>  x'm y'm
>

n is the number of vertices of the convex polygon R, and m is that of S. n and m are integers and satisfy 3 ≤ n ≤ 1000 and 3 ≤ m ≤ 1000. (xi, yi) represents the coordinates of the i-th vertex of the convex polygon R and (x'i, y'i) represents that of S. xi, yi, x'i and y'i are integers between −106 and 106, inclusive. The vertices of each convex polygon are given in counterclockwise order. Three different vertices of one convex polygon do not lie on a single line.

The end of the input is indicated by a line containing two zeros.

Output

For each dataset, output a single line containing an integer representing the double of the sum of the areas of P and Q. Note that the areas are always integers when doubled because the coordinates of each vertex of P and Q are integers.

Sample Input


5 3
0 0
2 0
2 1
1 2
0 2
0 0
1 0
0 1
4 4
0 0
5 0
5 5
0 5
0 0
2 0
2 2
0 2
3 3
0 0
1 0
0 1
0 1
0 0
1 1
3 3
0 0
1 0
1 1
0 0
1 0
1 1
4 4
0 0
2 0
2 2
0 2
0 0
1 0
1 2
0 2
4 4
0 0
3 0
3 1
0 1
0 0
1 0
1 1
0 1
0 0


Output for the Sample Input


3
2
2
1
0
2






Example

Input

5 3
0 0
2 0
2 1
1 2
0 2
0 0
1 0
0 1
4 4
0 0
5 0
5 5
0 5
0 0
2 0
2 2
0 2
3 3
0 0
1 0
0 1
0 1
0 0
1 1
3 3
0 0
1 0
1 1
0 0
1 0
1 1
4 4
0 0
2 0
2 2
0 2
0 0
1 0
1 2
0 2
4 4
0 0
3 0
3 1
0 1
0 0
1 0
1 1
0 1
0 0


Output

3
2
2
1
0
2

Solution (in CPP):

Solution:
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <set>
using namespace std;

typedef long long LL;
typedef pair<LL,LL> pll;

pll add(const pll &a, const pll &b){
	return pll(a.first + b.first, a.second + b.second);
}

pll sub(const pll &a, const pll &b){
	return pll(a.first - b.first, a.second - b.second);
}

pll mul(LL t, const pll &a){
	return pll(a.first * t, a.second * t);
}

LL cross(const pll &a, const pll &b){
	return a.first * b.second - b.first * a.second;
}

LL div(const pll &a, const pll &b){
	if(b.first != 0){ return a.first / b.first; }
	return a.second / b.second;
}

vector<pll> input(int n){
	vector<pll> pts(n);
	for(int i = 0; i < n; ++i){
		cin >> pts[i].first >> pts[i].second;
	}
	rotate(pts.begin(), min_element(pts.begin(), pts.end()), pts.end());

	vector<pll> vec(n);
	for(int i = 0; i < n; ++i){
		vec[i] = sub(pts[i + 1], pts[i]);
	}
	vec[n - 1] = sub(pts[0], pts[n - 1]);
	return vec;
}

LL area(const vector<pll> &v){
	int n = v.size();
	pll p;
	LL s = 0;
	for(int i = 0; i < n; ++i){
		pll q = add(p, v[i]);
		s += cross(p, q);
		p = q;
	}
	return s;
}

int main(){
	int n, m;
	while(cin >> n >> m && n){
		vector<pll> v1 = input(n);
		vector<pll> v2 = input(m);
		if(area(v1) > area(v2)){ v1.swap(v2); }
		vector<int> idxs;
		while(true){
			int s1 = v1.size(), s2 = v2.size();
			idxs.assign(s1, -1);
			int j = 0;
			LL u = 1LL << 50;
			for(int i = 0; i < s1; ++i){
				for(; j < s2; ++j){
					if(cross(v1[i], v2[j]) == 0){ break; }
				}
				if(j >= s2){
					u = 0;
					break;
				}
				idxs[i] = j;
				LL t = div(v2[j], v1[i]);
				u = min(t, u);
				++j;
			}
			if(u <= 0){ break; }
			for(int i = 0; i < s1; ++i){
				int k = idxs[i];
				v2[k] = sub(v2[k], mul(u, v1[i]));
			}
			v2.erase(remove(v2.begin(), v2.end(), pll()), v2.end());
			v1.swap(v2);
		}
		LL a1 = area(v1);
		LL a2 = area(v2);
		cout << (a1 + a2) << endl;
	}
}