#include <cstdio>
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <fstream>
#define rep( i, l, r ) for (int i = l; i <= r; i++)
#define down( i, l, r ) for (int i = l; i >= r; i--)
#define MS 123456
#define MAX 1073741823
#define MIN 1E-6
#define Q 100000007
using namespace std;
struct node
{
int x, y;
} p[23];
struct Animal
{
int x, y, age, hp, maxhp, l, last;
bool cake;
} Ant[234567];
int n, m, s, d, r, T, Now, NowAnt, AllAnt, Map[9][9], Alive[9], Target, Message[9][9], a, x, y, Choose, CM, Nowd;
double AntHp;
void IncAnt()
{
if (NowAnt == 6) return;
if (Map[0][0] != 0) return;
NowAnt++; AllAnt++;
if (AllAnt%6 == 1) AntHp *= 1.1;
Ant[AllAnt].x = 0; Ant[AllAnt].y = 0;
Ant[AllAnt].age = 0; Ant[AllAnt].hp = int(AntHp); Ant[AllAnt].maxhp = int(AntHp);
Ant[AllAnt].l = (AllAnt-1)/6+1; Ant[AllAnt].cake = false;
Ant[AllAnt].last = 0;
Alive[NowAnt] = AllAnt;
Map[0][0] = 1;
}
void AddMessage()
{
rep(i, 1, NowAnt)
{
a = Alive[i];
if (Ant[a].cake) Message[Ant[a].x][Ant[a].y] += 5; else Message[Ant[a].x][Ant[a].y] += 2;
}
}
void Move()
{
rep(i, 1, NowAnt)
{
a = Alive[i]; x = Ant[a].x; y = Ant[a].y;
Choose = 0; CM = -MAX;
if (Ant[a].last != 3 && y < m && CM < Message[x][y+1] && Map[x][y+1] == 0) Choose = 1, CM = Message[x][y+1];
if (Ant[a].last != 4 && x < n && CM < Message[x+1][y] && Map[x+1][y] == 0) Choose = 2, CM = Message[x+1][y];
if (Ant[a].last != 1 && y > 0 && CM < Message[x][y-1] && Map[x][y-1] == 0) Choose = 3, CM = Message[x][y-1];
if (Ant[a].last != 2 && x > 0 && CM < Message[x-1][y] && Map[x-1][y] == 0) Choose = 4, CM = Message[x-1][y];
if ((Ant[a].age+1) % 5 == 0 && Choose != 0)
{
while (true)
{
Choose--;
if (Choose == 0) Choose = 4;
if (Choose == 1 && Ant[a].last != 3 && y < m && Map[x][y+1] == 0) break;
if (Choose == 2 && Ant[a].last != 4 && x < n && Map[x+1][y] == 0) break;
if (Choose == 3 && Ant[a].last != 1 && y > 0 && Map[x][y-1] == 0) break;
if (Choose == 4 && Ant[a].last != 2 && x > 0 && Map[x-1][y] == 0) break;
}
}
Map[x][y] = 0; Ant[a].last = Choose;
if (Choose == 0) Map[x][y] = 1;
if (Choose == 1) Map[x][y+1] = 1, Ant[a].y++;
if (Choose == 2) Map[x+1][y] = 1, Ant[a].x++;
if (Choose == 3) Map[x][y-1] = 1, Ant[a].y--;
if (Choose == 4) Map[x-1][y] = 1, Ant[a].x--;
}
}
void MoveCake()
{
rep(i, 1, NowAnt)
{
a = Alive[i];
if (Ant[a].x == n && Ant[a].y == m)
{
Target = a;
Ant[a].cake = true;
Ant[a].hp += Ant[a].maxhp/2; if (Ant[a].hp > Ant[a].maxhp) Ant[a].hp = Ant[a].maxhp;
continue;
}
}
}
int sqr(int x) { return x*x; }
int Dis(int x1, int y1, int x2, int y2) { return sqr(x1-x2)+sqr(y1-y2); }
void FightAnt(int s, int t)
{
int a1, b1, c1, a2, b2, c2;
rep(i, 1, NowAnt)
{
a = Alive[i];
if (a == t)
{ Ant[a].hp -= d; continue; }
if (Dis(p[s].x, p[s].y, Ant[a].x, Ant[a].y) <= 0.25)
{ Ant[a].hp -= d; continue; }
if (Dis(Ant[t].x, Ant[t].y, Ant[a].x, Ant[a].y) <= 0.25)
{ Ant[a].hp -= d; continue; }
if (sqr(abs(p[s].x*Ant[t].y-p[s].x*Ant[a].y+Ant[t].x*Ant[a].y-Ant[t].x*p[s].y+Ant[a].x*p[s].y-Ant[a].x*Ant[t].y)) > Dis(p[s].x, p[s].y, Ant[t].x, Ant[t].y)*0.25) continue;
a1 = p[s].y-Ant[t].y; b1 = Ant[t].x-p[s].x; c1 = -a1*p[s].x-b1*p[s].y; a2 = -b1; b2 = a1; c2 = -a2*Ant[a].x-b2*Ant[a].y;
if (b1 == 0)
{
if ((p[s].y <= Ant[a].y && Ant[a].y <= Ant[t].y) || (Ant[t].y <= Ant[a].y && Ant[a].y <= p[s].y))
{ Ant[a].hp -= d; continue; }
}
else if (a1 == 0)
{
if ((p[s].x <= Ant[a].x && Ant[a].x <= Ant[t].x) || (Ant[t].x <= Ant[a].x && Ant[a].x <= p[s].x))
{ Ant[a].hp -= d; continue; }
}
else if (a1*b2-a2*b1 > 0)
{
if ((p[s].x*(a1*b2-a2*b1) <= c2*b1-c1*b2 && c2*b1-c1*b2 <= Ant[t].x*(a1*b2-a2*b1)) || (Ant[t].x*(a1*b2-a2*b1) <= c2*b1-c1*b2 && c2*b1-c1*b2 <= p[s].x*(a1*b2-a2*b1)))
{ Ant[a].hp -= d; continue; }
}
else
{
if ((p[s].x*(a1*b2-a2*b1) >= c2*b1-c1*b2 && c2*b1-c1*b2 <= Ant[t].x*(a1*b2-a2*b1)) || (Ant[t].x*(a1*b2-a2*b1) >= c2*b1-c1*b2 && c2*b1-c1*b2 <= p[s].x*(a1*b2-a2*b1)))
{ Ant[a].hp -= d; continue; }
}
}
}
void Fight()
{
rep(i, 1, s)
{
if (Target != 0)
{
Nowd = sqr(Ant[Target].x - p[i].x) + sqr(Ant[Target].y - p[i].y);
if (Nowd <= r)
{
FightAnt(i, Target);
continue;
}
}
Choose = 0; CM = MAX;
rep(j, 1, NowAnt)
{
a = Alive[j];
Nowd = sqr(Ant[a].x - p[i].x) + sqr(Ant[a].y - p[i].y);
if (Nowd < CM) CM = Nowd, Choose = a;
}
if (Choose != 0 && CM <= r) FightAnt(i, Choose);
}
}
void PutCake()
{
Ant[Target].cake = false;
Target = 0;
}
void DelDie()
{
int i = 0;
while (i < NowAnt)
{
i++;
a = Alive[i];
if (Ant[a].hp < 0)
{
Map[Ant[a].x][Ant[a].y] = 0;
rep(j, i, NowAnt-1) Alive[j] = Alive[j+1];
NowAnt--; i--;
}
}
}
void End(bool b)
{
if (b) printf("Game over after %d seconds\n%d\n", Now, NowAnt); else printf("The game is going on\n%d\n", NowAnt);
rep(i, 1, NowAnt)
{
a = Alive[i];
printf("%d %d %d %d %d\n", Ant[a].age, Ant[a].l, Ant[a].hp, Ant[a].x, Ant[a].y);
}
exit(0);
}
void DelMessage()
{
rep(i, 0, n) rep(j, 0, m) if (Message[i][j] > 0) Message[i][j]--;
}
void AddAge()
{
rep(i, 1, NowAnt) Ant[Alive[i]].age++;
}
int main()
{
//freopen("curves.in", "r", stdin);
//freopen("curves.out", "w", stdout);
scanf("%d%d%d%d%d", &n, &m, &s, &d, &r);
rep(i, 1, s) { scanf("%d%d", &p[i].x, &p[i].y); Map[p[i].x][p[i].y] = 2; }
AntHp = 4; r *= r;
scanf("%d", &T);
while (T > Now)
{
Now++;
if (Now == 765)
a = a;
IncAnt();
AddMessage();
Move();
if (Target == 0 && Map[n][m] == 1) MoveCake();
Fight();
if (Target != 0 && Ant[Target].hp < 0) PutCake();
DelDie();
if (Target != 0 && Ant[Target].x == 0 && Ant[Target].y == 0) End(true);
DelMessage();
AddAge();
}
End(false);
//fclose(stdin);
//fclose(stdout);
return 0;
}
I2luY2x1ZGUgPGNzdGRpbz4KI2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0cmluZz4KI2luY2x1ZGUgPGNtYXRoPgojaW5jbHVkZSA8YWxnb3JpdGhtPgojaW5jbHVkZSA8Y3N0ZGxpYj4KI2luY2x1ZGUgPGZzdHJlYW0+CgojZGVmaW5lIHJlcCggaSwgbCwgciApIGZvciAoaW50IGkgPSBsOyBpIDw9IHI7IGkrKykKI2RlZmluZSBkb3duKCBpLCBsLCByICkgZm9yIChpbnQgaSA9IGw7IGkgPj0gcjsgaS0tKQojZGVmaW5lIE1TIDEyMzQ1NgojZGVmaW5lIE1BWCAxMDczNzQxODIzCiNkZWZpbmUgTUlOIDFFLTYKI2RlZmluZSBRIDEwMDAwMDAwNwoKdXNpbmcgbmFtZXNwYWNlI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