Problem: Once upon a time in a kingdom far, far away… Okay, let’s start at the point where Ivan the Fool met Gorynych the Dragon. Ivan took out his magic sword and the battle began. First Gorynych had h heads and t tails. With each strike of the sword Ivan can either cut off several heads (from 1 to n, but not more than Gorynych has at the moment), or several tails (from 1 to m, but not more than Gorynych has at the moment). At the same time, horrible though it seems, Gorynych the Dragon can also grow new heads and tails. And the number of growing heads and tails is determined uniquely by the number of heads or tails cut by the current strike. When the total number of heads and tails exceeds R, Gorynych the Dragon strikes its final blow and destroys Ivan the Fool. That’s why Ivan aims to cut off all the dragon’s heads and tails as quickly as possible and win. The events can also develop in a third way: neither of the opponents can win over the other one and they will continue fighting forever.

The tale goes like this; easy to say, hard to do. Your task is to write a program that will determine the battle’s outcome. Consider that Ivan strikes consecutively. After each blow Gorynych grows a number of new heads and tails depending on the number of cut ones. Gorynych the Dragon is defeated if after the blow he loses all his heads and tails and can’t grow new ones. Ivan fights in the optimal way (fools are lucky), i.e. 

  * if Ivan can win, he wins having struck the least number of blows; 
  * if it is impossible to defeat Gorynych, but is possible to resist him for an infinitely long period of time, then that’s the strategy Ivan chooses; 
  * if Gorynych wins in any case, Ivan aims to resist him for as long as possible. 

Input

The first line contains three integers h, t and R (0 ≤ h, t, R ≤ 200, 0 < h + t ≤ R) which represent the initial numbers of Gorynych’s heads and tails and the largest total number of heads and tails with which Gorynych the Dragon does not yet attack. The next line contains integer n (1 ≤ n ≤ 200). The next n contain pairs of non-negative numbers "hi ti" which represent the number of heads and the number of tails correspondingly, that will grow if Gorynych has i heads (1 ≤ i ≤ n) cut. The next line contains an integer m (1 ≤ m ≤ 200) and then — the description of Gorynych’s behavior when his tails are cut off in the format identical to the one described above. All the numbers in the input file do not exceed 200. 

Output

Print "Ivan" (without quotes) in the first line if Ivan wins, or "Zmey" (that means a dragon in Russian) if Gorynych the Dragon wins. In the second line print a single integer which represents the number of blows Ivan makes. If the battle will continue forever, print in the first line "Draw".

Examples

Input

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


Output

Ivan
2


Input

2 2 4
1
0 1
1
1 0


Output

Draw


Input

2 2 5
1
1 1
1
3 0


Output

Zmey
2

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16000000")
using namespace std;
const int Inf = 1000000000;
const int Maxn = 405;
int h, t, R;
int n, h1[Maxn], t1[Maxn];
int m, h2[Maxn], t2[Maxn];
vector<pair<int, int> > neigh[Maxn][Maxn], rneigh[Maxn][Maxn];
int res1[Maxn][Maxn], res2[Maxn][Maxn];
int taken[Maxn][Maxn];
bool added[Maxn][Maxn];
vector<pair<int, int> > V;
void Dijkstra() {
  fill((int*)res2, (int*)res2 + Maxn * Maxn, Inf);
  res1[0][0] = 1;
  res2[0][0] = 0;
  priority_queue<pair<int, pair<int, int> > > Q;
  Q.push(pair<int, pair<int, int> >(0, pair<int, int>(0, 0)));
  while (!Q.empty()) {
    pair<int, int> v = Q.top().second;
    int d = -Q.top().first;
    Q.pop();
    if (res2[v.first][v.second] != d) continue;
    res1[v.first][v.second] = 1;
    for (int i = 0; i < neigh[v.first][v.second].size(); i++) {
      pair<int, int> u = neigh[v.first][v.second][i];
      if (d + 1 < res2[u.first][u.second]) {
        res2[u.first][u.second] = d + 1;
        Q.push(pair<int, pair<int, int> >(-(d + 1), u));
      }
    }
  }
}
void DFS(int i, int j) {
  if (res1[i][j] == 1 || taken[i][j] == 2) return;
  if (taken[i][j] == 1) {
    if (!added[i][j]) {
      V.push_back(pair<int, int>(i, j));
      added[i][j] = true;
    }
    return;
  }
  taken[i][j] = 1;
  for (int k = 0; k < neigh[i][j].size(); k++) {
    pair<int, int> u = neigh[i][j][k];
    DFS(u.first, u.second);
  }
  taken[i][j] = 2;
}
void BFS() {
  for (int i = 0; i < V.size(); i++) {
    pair<int, int> v = V[i];
    res1[v.first][v.second] = 0;
    for (int j = 0; j < neigh[v.first][v.second].size(); j++) {
      pair<int, int> u = neigh[v.first][v.second][j];
      if (res1[u.first][u.second] == -2 && !added[u.first][u.second]) {
        V.push_back(u);
        added[u.first][u.second] = true;
      }
    }
  }
}
int Get(int i, int j) {
  if (i + j > R) return 0;
  if (!added[i][j]) {
    res2[i][j] = 0;
    for (int k = 0; k < rneigh[i][j].size(); k++) {
      pair<int, int> u = rneigh[i][j][k];
      res2[i][j] = max(res2[i][j], Get(u.first, u.second) + 1);
    }
    added[i][j] = true;
  }
  return res2[i][j];
}
int main() {
  scanf("%d %d %d", &h, &t, &R);
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d %d", &h1[i], &t1[i]);
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) scanf("%d %d", &h2[i], &t2[i]);
  for (int i = 0; i <= R; i++)
    for (int j = 0; i + j <= R; j++) {
      for (int k = 1; k <= n && k <= i; k++) {
        neigh[i - k + h1[k]][j + t1[k]].push_back(pair<int, int>(i, j));
        rneigh[i][j].push_back(pair<int, int>(i - k + h1[k], j + t1[k]));
      }
      for (int k = 1; k <= m && k <= j; k++) {
        neigh[i + h2[k]][j - k + t2[k]].push_back(pair<int, int>(i, j));
        rneigh[i][j].push_back(pair<int, int>(i + h2[k], j - k + t2[k]));
      }
    }
  fill((int*)res1, (int*)res1 + Maxn * Maxn, -2);
  Dijkstra();
  for (int i = 0; i < Maxn; i++)
    for (int j = 0; j < Maxn; j++)
      if (res1[i][j] == -2 && !taken[i][j]) DFS(i, j);
  BFS();
  fill((bool*)added, (bool*)added + Maxn * Maxn, false);
  for (int i = 0; i < Maxn; i++)
    for (int j = 0; j < Maxn; j++)
      if (res1[i][j] == -2) {
        res1[i][j] = -1;
        Get(i, j);
      }
  if (res1[h][t] == 1)
    printf("Ivan\n%d\n", res2[h][t]);
  else if (res1[h][t] == 0)
    printf("Draw\n");
  else
    printf("Zmey\n%d\n", res2[h][t]);
  return 0;
}