Problem: As a professional private tutor, Kuroni has to gather statistics of an exam. Kuroni has appointed you to complete this important task. You must not disappoint him.

The exam consists of n questions, and m students have taken the exam. Each question was worth 1 point. Question i was solved by at least l_i and at most r_i students. Additionally, you know that the total score of all students is t.

Furthermore, you took a glance at the final ranklist of the quiz. The students were ranked from 1 to m, where rank 1 has the highest score and rank m has the lowest score. Ties were broken arbitrarily.

You know that the student at rank p_i had a score of s_i for 1 ≤ i ≤ q.

You wonder if there could have been a huge tie for first place. Help Kuroni determine the maximum number of students who could have gotten as many points as the student with rank 1, and the maximum possible score for rank 1 achieving this maximum number of students.

Input

The first line of input contains two integers (1 ≤ n, m ≤ 10^{5}), denoting the number of questions of the exam and the number of students respectively.

The next n lines contain two integers each, with the i-th line containing l_{i} and r_{i} (0 ≤ l_{i} ≤ r_{i} ≤ m).

The next line contains a single integer q (0 ≤ q ≤ m). 

The next q lines contain two integers each, denoting p_{i} and s_{i} (1 ≤ p_{i} ≤ m, 0 ≤ s_{i} ≤ n). It is guaranteed that all p_{i} are distinct and if p_{i} ≤ p_{j}, then s_{i} ≥ s_{j}.

The last line contains a single integer t (0 ≤ t ≤ nm), denoting the total score of all students.

Output

Output two integers: the maximum number of students who could have gotten as many points as the student with rank 1, and the maximum possible score for rank 1 achieving this maximum number of students. If there is no valid arrangement that fits the given data, output -1 -1.

Examples

Input


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


Output


3 2


Input


5 6
0 6
0 6
2 5
6 6
4 6
1
3 3
30


Output


-1 -1

Note

For the first sample, here is one possible arrangement that fits the data:

Students 1 and 2 both solved problems 1 and 2.

Student 3 solved problems 2 and 3.

Student 4 solved problem 4.

The total score of all students is T = 7. Note that the scores of the students are 2, 2, 2 and 1 respectively, which satisfies the condition that the student at rank 4 gets exactly 1 point. Finally, 3 students tied for first with a maximum score of 2, and it can be proven that we cannot do better with any other arrangement.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
int n, m, q, p[N], pos[N];
long long t, l[N], r[N], w[N], c[N], v[N];
inline bool checkx(int i, int j, int k) {
  return ((v[j + 1] - v[k + 1]) * (j - i) >= (v[i + 1] - v[j + 1]) * (k - i));
}
inline bool check(int d, int c) {
  long long siz = t;
  for (int i = m; i > c; i--) v[i] = max(v[i + 1], w[i]);
  for (int i = 1; i <= c; i++) v[i] = d, pos[i] = i;
  for (int i = m; i >= 1; i--) siz -= v[i];
  for (int i = 1; i <= m; i++)
    if (w[i] != -1 && w[i] != v[i]) return false;
  for (int i = 2; i <= m; i++)
    if (w[i] != -1 || i <= c)
      pos[i] = i;
    else
      pos[i] = pos[i - 1];
  if (siz < 0) return false;
  for (int i = m; i >= 1; i--) {
    if (pos[i] == i) continue;
    v[i] = max(v[i], v[i + 1]);
    while (v[i] < v[pos[i]] && siz >= i - pos[i])
      v[i]++, siz = siz - i + pos[i];
  }
  p[p[0] = 1] = 0;
  for (int i = m; i >= 1; i--) v[i] = v[i] + v[i + 1];
  for (int i = 1; i <= m; i++) {
    while (p[0] >= 2 && checkx(p[p[0] - 1], p[p[0]], i)) p[0]--;
    p[++p[0]] = i;
  }
  int z = 1;
  for (int i = n; i >= 0; i--) {
    int x = n - i;
    if (v[p[z] + 1] + p[z] * i >= v[p[z + 1] + 1] + p[z + 1] * i &&
        z + 1 <= p[0])
      z++;
    if (v[p[z] + 1] + 1ll * p[z] * i + l[x] < l[n]) return false;
  }
  z = 1;
  for (int i = n; i >= 0; i--) {
    int x = n - i;
    if (v[p[z] + 1] + p[z] * i >= v[p[z + 1] + 1] + p[z + 1] * i &&
        z + 1 <= p[0])
      z++;
    if (v[p[z] + 1] + 1ll * p[z] * i + r[x] < t) return false;
  }
  return true;
}
int main() {
  cin >> n >> m;
  int a, b, z;
  long long v1 = 0, v2 = 0;
  z = 0;
  for (int i = 1; i <= n; i++) scanf("%lld%lld", &l[i], &r[i]);
  sort(l + 1, l + n + 1), sort(r + 1, r + n + 1);
  for (int i = 1; i <= n; i++) l[i] += l[i - 1], r[i] += r[i - 1];
  for (int i = 1; i <= m; i++) w[i] = -1;
  cin >> q;
  while (q--) scanf("%d%d", &a, &b), w[a] = b, z = max(z, b);
  c[0] = -1;
  cin >> t;
  for (int i = 1; i <= m; i++)
    if (w[i] != -1)
      c[i] = w[i];
    else
      c[i] = c[i - 1];
  int ans = -1, vt = -1, res = -1;
  long long sum = 0;
  int cnt = 0;
  for (int i = 1; i <= m; i++)
    if (c[i] != -1)
      sum += c[i];
    else
      cnt++;
  for (int i = z; i <= n; i++)
    if (1ll * cnt * i + sum >= t) {
      vt = i;
      break;
    }
  if (vt == -1 || !check(vt, 1)) {
    cout << -1 << " " << -1 << endl;
    return 0;
  }
  int l = 1, r = m;
  while (l <= r) {
    int d = (l + r) >> 1;
    if (check(vt, d))
      ans = d, l = d + 1;
    else
      r = d - 1;
  }
  l = vt, r = n;
  while (l <= r) {
    int d = (l + r) >> 1;
    if (check(d, ans))
      res = d, l = d + 1;
    else
      r = d - 1;
  }
  cout << ans << " " << res << endl;
}