package main import ( "fmt" "time" ) func scan() (N int, H int, M int, T int) { fmt.Scan(&N, &H, &M, &T) return } func main() { var N, H, M, T int N, H, M, T = scan() // N, H, M, T = 2, 7, 30, 5 // N, H, M, T = 7, 8, 0, 5 // N, H, M, T = 786679, 9, 42, 1001 // N, H, M, T = 109778, 21, 59, 73 // N, H, M, T = 1000000, 23, 59, 1440 t := time.Date(2000, 1, 1, H, M, 0, 0, time.UTC) // t = t.Add(time.Duration((N-1)*T) * time.Minute) for i := 0; i < N-1; i++ { t = t.Add(time.Duration(T) * time.Minute) } fmt.Println(t.Hour()) fmt.Println(t.Minute()) }