import java.util.*;
public class Q2_B_runner_byClass {
public static void main(String[] args) {
// atCoder 조깅문제
new Q2Solver().solve();
}
}
class Q2Solver{
private Runner taka; // class안에 class인거지..?
private Runner aoki;
private int runTime;
public void solve() {
init();
for(int x = 0 ; x < runTime ; x++) {
taka.run();
aoki.run();
}
if(taka.getDistance() > aoki.getDistance()) {
System.out.println(taka.getName());
}else if(aoki.getDistance() > taka.getDistance()) {
System.out.println(aoki.getName());
}else {
System.out.println("draw");
}
}
private void init() {
Scanner scn = new Scanner(System.in);
System.out.print("값 입력 > ");
String inputValue = scn.nextLine();
// System.out.println("입력 받은 값 : " + inputValue);
String [] inputs = inputValue.split(" ");
int tMaxRun = Integer.parseInt(inputs[0]);
int tSpeed = Integer.parseInt(inputs[1]);
int tMaxRest = Integer.parseInt(inputs[2]);
int aMaxRun = Integer.parseInt(inputs[3]);
int aSpeed = Integer.parseInt(inputs[4]);
int aMaxRest = Integer.parseInt(inputs[5]);
runTime = Integer.parseInt(inputs[6]);
taka = new Runner("taka", tSpeed, tMaxRun, tMaxRest);
aoki = new Runner("aoki", aSpeed, aMaxRun, aMaxRest);
scn.close();
}
class Runner{
private String name;
private int speed;
private int maximumStrength;
private int maximumBreakTime;
private int remainingHealth;
private int remainingBreakTime;
private int distance;
// main에서 사용해야하는데 pubilc으로 푸는건 절대 XXX! 읽기만하고 쓰는건 못하는 API를 쓰자.
public Runner(String name, int speed, int maximumStrength, int maximumBreakTime) {
this.name = name;
this.speed = speed;
this.maximumStrength = maximumStrength;
this.maximumBreakTime = maximumBreakTime;
this.remainingHealth = maximumStrength;
}
public void run() {
if(existHealth()) {
distance += speed;
decreaseHealth();
}else {
decreaseBreakTime();
}
}
private boolean existHealth() {
return remainingHealth > 0;
}
private void decreaseHealth() {
remainingHealth --;
if(!existHealth()) {
chargeBreakTime();
}
}
private void chargeBreakTime() {
remainingHealth = maximumBreakTime;
}
private void decreaseBreakTime() {
remainingBreakTime--;
if(remainingBreakTime <= 0) {
remainingHealth = maximumStrength;
}
}
// ====================== 밑에 이것만은 알아라 ===================
public int getDistance() {
return distance;
}
public String getName() {
return name;
}