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.
#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXQUESTION = 100000;
const int MAXSTUDENT = 100000;
struct Fix {
  int rank, score;
};
bool operator<(const Fix& a, const Fix& b) { return a.rank < b.rank; }
int nquestion, nstudent;
int lcorrect[MAXQUESTION], rcorrect[MAXQUESTION];
int nfix;
Fix fix[MAXSTUDENT];
long long totscore;
int score[MAXSTUDENT];
long long lsum[MAXQUESTION + 1], rsum[MAXQUESTION + 1];
long long scoresum[MAXSTUDENT + 1];
bool calcscore(int ntie, int tiescore) {
  for (int rep = (0); rep < (2); ++rep) {
    for (int i = (0); i < (nstudent); ++i) score[i] = -1;
    for (int i = (0); i < (nfix); ++i) score[fix[i].rank] = fix[i].score;
    for (int i = (0); i < (ntie); ++i)
      if (score[i] != -1) {
        if (tiescore == -1) tiescore = score[i];
        if (score[i] != tiescore) return false;
      }
    if (tiescore != -1)
      for (int i = (0); i < (ntie); ++i) score[i] = tiescore;
    long long havescore = 0;
    int lastscore = 0;
    for (int i = nstudent - 1; i >= 0; --i) {
      if (score[i] != -1) {
        if (score[i] < lastscore) return false;
        lastscore = score[i];
      }
      havescore += lastscore;
    }
    if (havescore > totscore) return false;
    long long remscore = totscore - havescore;
    lastscore = 0;
    int lastidx = nstudent;
    for (int i = nstudent - 1; i >= 0; --i)
      if (score[i] != -1) {
        int cntbetween = lastidx - i - 1, limextraeach = score[i] - lastscore;
        if (cntbetween >= 1) {
          long long curextratot =
              min((long long)limextraeach * cntbetween, remscore);
          long long curextraeach = curextratot / cntbetween;
          int curextrarem = curextratot % cntbetween;
          for (int j = (0); j < (cntbetween); ++j)
            score[i + j + 1] =
                lastscore + curextraeach + (j < curextrarem ? 1 : 0);
          remscore -= curextratot;
        }
        lastscore = score[i], lastidx = i;
      }
    {
      int cntbefore = lastidx, limextraeach = nquestion - lastscore;
      if (cntbefore >= 1) {
        long long curextratot =
            min((long long)limextraeach * cntbefore, remscore);
        long long curextraeach = curextratot / cntbefore;
        int curextrarem = curextratot % cntbefore;
        assert(cntbefore >= ntie && tiescore == -1);
        if (curextrarem != 0 && curextrarem < ntie) {
          tiescore = lastscore + curextraeach + 1;
          continue;
        }
        for (int j = (0); j < (cntbefore); ++j)
          score[j] = lastscore + curextraeach + (j < curextrarem ? 1 : 0);
        remscore -= curextratot;
      }
    }
    if (remscore != 0)
      return false;
    else
      break;
  }
  return true;
}
long long divdown(long long num, long long den) {
  return num >= 0 ? num / den : (num - den + 1) / den;
}
struct CHMin {
  vector<pair<int, long long>> q;
  void init() { q.clear(); }
  long long overtake(const pair<int, long long>& p,
                     const pair<int, long long>& q) {
    return divdown(q.second - p.second, p.first - q.first);
  }
  void add(int a, long long b) {
    if (((int)(q).size()) >= 1) assert(a > q[((int)(q).size()) - 1].first);
    while (((int)(q).size()) >= 2 &&
           overtake(q[((int)(q).size()) - 1], q[((int)(q).size()) - 2]) <=
               overtake(make_pair(a, b), q[((int)(q).size()) - 2]))
      q.pop_back();
    q.push_back(make_pair(a, b));
  }
  long long get(int x) {
    while (((int)(q).size()) >= 2 &&
           overtake(q[((int)(q).size()) - 1], q[((int)(q).size()) - 2]) < x)
      q.pop_back();
    return (long long)x * q[((int)(q).size()) - 1].first +
           q[((int)(q).size()) - 1].second;
  }
};
CHMin ch1, ch2;
bool isfeasable() {
  scoresum[0] = 0;
  for (int i = (0); i < (nstudent); ++i)
    scoresum[i + 1] = scoresum[i] + score[nstudent - i - 1];
  ch1.init();
  for (int j = (0); j <= (nquestion); ++j)
    ch1.add(j, rsum[j] - (long long)nstudent * j);
  ch2.init();
  for (int j = (0); j <= (nquestion); ++j)
    ch2.add(j, lsum[j] - (long long)nstudent * j);
  for (int i = (0); i <= (nstudent); ++i) {
    long long lhs1 = ch1.get(i), rhs1 = totscore - scoresum[i] -
                                        (long long)nstudent * nquestion +
                                        (long long)i * nquestion;
    long long lhs2 = ch2.get(i), rhs2 = lsum[nquestion] - scoresum[i] -
                                        (long long)nstudent * nquestion +
                                        (long long)i * nquestion;
    if (lhs1 < rhs1 || lhs2 < rhs2) return false;
  }
  return true;
}
pair<int, int> ans;
bool solve() {
  sort(fix, fix + nfix);
  for (int i = (0); i < (nquestion); ++i)
    lsum[i + 1] = lcorrect[i], rsum[i + 1] = rcorrect[i];
  sort(lsum + 1, lsum + nquestion + 1);
  sort(rsum, rsum + nquestion + 1);
  for (int i = (0); i < (nquestion); ++i)
    lsum[i + 1] += lsum[i], rsum[i + 1] += rsum[i];
  if (!calcscore(1, -1)) return false;
  if (!isfeasable()) return false;
  int lo = 1, hi = nstudent + 1;
  while (lo + 1 < hi) {
    int mi = lo + (hi - lo) / 2;
    if (!calcscore(mi, -1) || !isfeasable())
      hi = mi;
    else
      lo = mi;
  }
  int ntie = lo;
  assert(calcscore(ntie, -1));
  lo = score[0], hi = nquestion + 1;
  while (lo + 1 < hi) {
    int mi = lo + (hi - lo) / 2;
    if (!calcscore(ntie, mi) || !isfeasable())
      hi = mi;
    else
      lo = mi;
  }
  int tiescore = lo;
  ans = make_pair(ntie, tiescore);
  return true;
}
void run() {
  scanf("%d%d", &nquestion, &nstudent);
  for (int i = (0); i < (nquestion); ++i)
    scanf("%d%d", &lcorrect[i], &rcorrect[i]);
  scanf("%d", &nfix);
  for (int i = (0); i < (nfix); ++i)
    scanf("%d%d", &fix[i].rank, &fix[i].score), --fix[i].rank;
  scanf("%lld", &totscore);
  if (!solve()) {
    printf("-1 -1\n");
    return;
  }
  printf("%d %d\n", ans.first, ans.second);
}
int main() {
  run();
  return 0;
}
