Олимпиадный тренинг

Задача 34773. Fathoms, arshins, spans, vershoks


Задача

Темы:
The old Russian measure of the length of a sazhen consisted of three arshins. One arshin was divided into four spans. One span consisted of 4 inches.
The merchant brought to the market a roll of cloth N vershoks long, but in order to pay the duty, he needs to indicate the length of the cloth in sazhens, arshins, spans and vershoks. Help him – translate the length of the cloth written in vershoks into sazhens, arshins, spans and vershoks.
The program receives as input one natural number N, not exceeding 2×109 , – the length of the cloth in inches.
The program should output 4 non-negative integers S, A, P, V – the number of sazhens, arshins, spans and vershoks, in total giving exactly N vershoks, while the value of A must be less than 3 (because 3 arshins give one sazhen), the value of P must be less than 4 (four spans give one arshin), the value of V must be less than 4 (four inches equals one span).
 
Input Output Note
30 0 1 3 2 30 inches is 0 fathoms, 1 arshin, 3 spans and 2 inches