Time Standards
InterviewTime limit2sMemory limit1024 MB
Given two time standards that set the hours, minutes, and seconds per unit, convert a moment from the first standard to the same moment in the second.
- Level
Easy2 of 10
- Topics
- Math, Implementation
- Solved
- No attempts yet
Statement
Every operating system (including the one Vasya is writing) must handle different time standards correctly.
For example, during the French Revolution, France used decimal time. A day had 10 decimal hours, each decimal hour had 100 decimal minutes, and each decimal minute had 100 decimal seconds.
Nobody knows which time formats will appear in the future, so Vasya wants to support various time standards. A time standard is given by three integers , , and : the number of "hours" in one day, the number of "minutes" in each "hour", and the number of seconds in each "minute". The length of a second and of a day is the same in every standard, but the length of a "minute" and an "hour" may differ.
Two time standards are given. Write a program that converts a time from one standard to the other.
Input
The first line contains three integers , , and , which describe the first time standard. The second line contains , , and in the same format. The third line contains three numbers , , and , a moment in the first standard, where is the number of "hours", is the number of "minutes", and is the number of seconds (, , ).
All numbers are non-negative integers not exceeding 1000. It is known that .
Output
Print three numbers , , and , the same moment in the second standard, where is the number of "hours", is the number of "minutes", and is the number of seconds (, , ).