Under construction

Still being built. Things may change

Sejong's Time Travel

Time limit1sMemory limit1024 MB

Summary
Given the current date and location and a target date and location, print the coordinates to enter, since the machine moves opposite to each entered change.
Level

Easy2 of 10

Topics
Math, Implementation
Solved
No attempts yet

Problem

Sejong, who had just enrolled at Sejong University, had dreamed of time travel since childhood. While studying hard at school, he recently heard a rumor from his friend Hanyang, who attends Hanyang University, that the university had secretly built a time machine!

Sejong ran to the Hanyang University lab where the time machine was kept and found a user manual that said:

  • Enter the year, month, and day of the destination.
  • Enter the latitude and longitude of the destination, exact to the third decimal place.
  • Press the travel button.

As he was about to time travel right after reading the manual, Sejong found a note he had not read yet!

The note said the following.

  • The time machine is not finished yet, so it moves in the opposite direction of the spatio-temporal coordinates entered. This is a serious bug.

  • For time, if the entered time is XX days after the current time, the machine moves XX days before. If the entered time is XX days before, the machine moves XX days after.

  • For latitude, if the entered latitude is north of the current latitude (an increase), the machine actually moves the same distance south (a decrease). If the entered latitude is south of the current latitude (a decrease), the machine actually moves the same distance north (an increase).

    • All latitude values are given near South Korea, so you do not need to consider cases where the latitude after moving is less than −90-90 or greater than 9090.
    • In every input and output of this problem, the latitude is guaranteed to be between 3636 and 3939, inclusive.
  • For longitude, if the entered longitude is east of the current longitude (an increase), the machine actually moves the same distance west (a decrease). If the entered longitude is west of the current longitude (a decrease), the machine actually moves the same distance east (an increase).

    • All longitude values are given near South Korea, so you do not need to consider cases where the longitude after moving is less than −180-180 or greater than 180180.
    • In every input and output of this problem, the longitude is guaranteed to be between 116116 and 140140, inclusive.
  • For example, if you start at latitude 37.037.0, longitude 127.0127.0 and enter latitude 37.537.5, longitude 130.0130.0, the machine actually moves you to latitude 36.536.5, longitude 124.0124.0.

Given the spatio-temporal coordinates Sejong is currently at and the spatio-temporal coordinates he wants to travel to, compute the coordinates he must enter into the time machine.

For convenience, assume that one year has 1212 months and one month has 3030 days.

Input

The first line contains the year Y0Y_0, month M0M_0, day D0D_0, latitude T0T_0, and longitude P0P_0 of the current time when Sejong boarded the time machine, separated by spaces. (2000≤Y0≤3000;(2000 \le Y_0 \le 3000; 1≤M0≤12;1 \le M_0 \le 12; 1≤D0≤30;1 \le D_0 \le 30; 37≤T0≤38;37 \le T_0 \le 38; 124≤P0≤132)124 \le P_0 \le 132)

The second line contains the year Y1Y_1, month M1M_1, day D1D_1, latitude T1T_1, and longitude P1P_1 of the time Sejong wants to travel to, separated by spaces. (2000≤Y1≤3000;(2000 \le Y_1 \le 3000; 1≤M1≤12;1 \le M_1 \le 12; 1≤D1≤30;1 \le D_1 \le 30; 37≤T1≤38;37 \le T_1 \le 38; 124≤P1≤132)124 \le P_1 \le 132)

All years, months, and days are given as integers, and all latitudes and longitudes are given exactly to the third decimal place.

No number has unnecessary leading zeros.

Output

Print the year, month, day, latitude, and longitude that Sejong must enter into the time machine on one line, separated by spaces.

Print the year, month, and day as integers, and print the latitude and longitude exactly to the third decimal place.

No number may have unnecessary leading zeros.

Hint

Latitude is the angle that measures how far a point lies north or south of the equator. North is positive and south is negative. The range is from −90-90 degrees (South Pole) to 9090 degrees (North Pole).

Longitude is the angle that measures how far a point lies east or west of the prime meridian (Royal Observatory, Greenwich). East is positive and west is negative. The range is from −180-180 degrees to 180180 degrees.

Examples3

  1. Example 1

    Input
    2024 9 20 37.556 127.047
    2624 9 20 37.532 127.117
    
    Expected output
    1424 9 20 37.580 126.977
    
  2. Example 2

    Input
    2624 9 20 37.551 127.074
    2024 9 20 37.503 127.095
    
    Expected output
    3224 9 20 37.599 127.053
    
  3. Example 3

    Input
    2024 1 1 37.000 127.000
    2024 1 2 37.500 130.000
    
    Expected output
    2023 12 30 36.500 124.000