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 GCC optimize("Ofast")
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 45000;
int h, lgn, n, t, r, x, y, a[N], dis[N], lp[N], dp[N][17];
vector<pair<int, int> > e1, e2;
vector<int> g[N];
bool mark[N];
int lg(int xx) {
  int l = 0;
  while (xx > 1) {
    xx /= 2;
    ++l;
  }
  return l;
}
void bfs(int d, vector<int> &v) {
  vector<int> w;
  for (int i = 0; i < v.size(); i++) {
    for (int j = 0; j < g[v[i]].size(); j++) {
      if (dis[g[v[i]][j]] == INT32_MAX) {
        dis[g[v[i]][j]] = d + 1;
        w.push_back(g[v[i]][j]);
      }
    }
  }
  if (!w.empty()) bfs(d + 1, w);
}
void dfs(int v) {
  mark[v] = true;
  for (int i = 0; i < g[v].size(); i++) {
    if (!mark[g[v][i]]) {
      dis[g[v][i]] = dis[v] + 1;
      dp[g[v][i]][0] = v;
      for (int j = 1; j <= lgn; j++)
        dp[g[v][i]][j] = dp[dp[g[v][i]][j - 1]][j - 1];
      dfs(g[v][i]);
    }
  }
}
int par(int v, int p) {
  while (p > 0) {
    int pp = p & (-p);
    v = dp[v][lg(pp)];
    p -= pp;
  }
  return v;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> h >> t >> r >> x;
  int hh, tt;
  for (int i = 0; i < x; i++) {
    cin >> hh >> tt;
    e1.push_back({hh, tt});
  }
  cin >> y;
  for (int i = 0; i < y; i++) {
    cin >> hh >> tt;
    e2.push_back({hh, tt});
  }
  for (int i = r; i >= 0; i--) {
    for (int j = r - i; j >= 0; j--) {
      for (int k = 0; k < min(x, i); k++) {
        if ((i - k - 1 + e1[k].first + j + e1[k].second) <= r)
          g[(r + 1) * i + j].push_back((i - k - 1 + e1[k].first) * (r + 1) + j +
                                       e1[k].second);
      }
      for (int k = 0; k < min(y, j); k++) {
        if ((i + e2[k].first + j - k - 1 + e2[k].second) <= r)
          g[(r + 1) * i + j].push_back((i + e2[k].first) * (r + 1) + j - k - 1 +
                                       e2[k].second);
      }
    }
  }
  n = (r + 1) * (r + 1);
  lgn = lg(n);
  int s = h * (r + 1) + t;
  fill(dis, dis + n, INT32_MAX);
  vector<int> v;
  v.push_back(s);
  dis[s] = 0;
  bfs(0, v);
  if (dis[0] != INT32_MAX) {
    cout << "Ivan\n" << dis[0];
    return 0;
  }
  for (int i = 0; i < n; i++) fill(dp[i], dp[i] + 17, s);
  dfs(s);
  for (int i = 0; i < n; i++) {
    if (dis[i] != INT32_MAX) {
      for (int j = 0; j < g[i].size(); j++) {
        if (dis[g[i][j]] <= dis[i] &&
            g[i][j] == par(i, dis[i] - dis[g[i][j]])) {
          cout << "Draw";
          return 0;
        }
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if (dis[i] != INT32_MAX) {
      for (int j = 0; j < g[i].size(); j++) ++a[g[i][j]];
    }
  }
  vector<int> w;
  w.push_back(s);
  while (!w.empty()) {
    int u = w[w.size() - 1];
    w.pop_back();
    for (int i = 0; i < g[u].size(); i++) {
      --a[g[u][i]];
      lp[g[u][i]] = max(lp[g[u][i]], lp[u] + 1);
      if (a[g[u][i]] == 0) w.push_back(g[u][i]);
    }
  }
  int ans = 0;
  for (int i = 0; i < n; i++) ans = max(ans, lp[i]);
  cout << "Zmey\n" << ans + 1;
}