QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 256 MB Puntuación total: 100

#7819. Colorful Clocks

Estadísticas

You have purchased a new mechanical clock where the time is displayed using three hands: hour, minute, and second. All hands move in a circle at a constant speed: the second hand completes a full circle in a minute, the minute hand in an hour, and the hour hand in 12 hours.

Each hand is supplied with paint, and as it rotates, each hand paints a sector of the clock face corresponding to the angle of rotation, with a radius equal to the length of the hand. Each hand paints the clock face instantly, and the paint dries instantly and does not smudge, even if a hand starts painting over an area that has already been painted by another hand.

The clock is started exactly at midnight, and the clock face is initially transparent. Determine what areas will be painted by the hour, minute, and second hands after a given number of seconds.

Input

The first and only line contains 4 positive integers separated by spaces. The first three numbers $H, M, S$ are the lengths of the hour, minute, and second hands, respectively. Each length is greater than the previous one and does not exceed $10$. The fourth number $N$ is the number of seconds that have passed since midnight, $0 \le N \le 24 \cdot 60 \cdot 60$. The lengths of the hands are given in centimeters.

Output

Output three lines, each containing one rational number — the areas in square centimeters of the parts of the clock face painted by the hour, minute, and second hands, respectively, divided by $\pi$.

Each number must be output in the following format:

  • If the number is 0, output 0.
  • If one of the parts (integer or fractional) is 0, it is not output.
  • If both the integer and fractional parts are non-zero, the integer part is output first, followed by the fractional part with a space between them.
  • The fractional part is output as an irreducible fraction "A/B", where $A$ is the numerator and $B$ is the denominator, $A, B$ are integers, $B > A > 0$.

Examples

Input 1

1 2 3 1

Output 1

1/43200
47/43200
67/450

Input 2

1 2 3 61

Output 2

659/31060800
1/900
8 31025629/31060800

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.