Seconds to days and hours

Split a number of seconds into whole days, hours, minutes and seconds. A day has 86400 seconds, an hour 3600 and a minute 60.

What to build

A program that splits one number into four units.

Requirements

  • Work out the whole days, then the whole hours left over, then the minutes, then the seconds.
  • Print the four numbers on one line.

Input

One whole number from 0 to 10000000.

Output

Four numbers on one line, separated by spaces: days, hours, minutes, seconds.

Constraints

The number is from 0 to 10000000.

Example

Input:

100000

Output:

1 3 46 40

Why it works

// says how many of a unit fit, and % gives what is left for the next, smaller unit.

Examples

Example 1 · Input
100000
Expected output
1 3 46 40
Example 2 · Input
59
Expected output
0 0 0 59

Prompts inside input() are ignored when checking, so input("n: ") is fine.

Hints

Hint 1

days = s // 86400, then keep the rest with s % 86400.

Solution

Show one correct solution (try it yourself first)
s = int(input())
days = s // 86400
s = s % 86400
hours = s // 3600
s = s % 3600
minutes = s // 60
seconds = s % 60
print(days, hours, minutes, seconds)

Lesson: Numbers and operators →