Land surveyors use grads (also known as gon, 400 grads in a full turn) in their documents. Grads are rather unwieldy though, so you need to write a JavaScript function that converts from grads to degrees.
In addition, your program needs to constrain the results within the range 0°≤x<360°, so if you arrive at a value like -15°, it needs to be converted to 345° and 420° becomes 60°.
The input comes as single number.
Examples:
Input:
100
Output:
90
Input:
400
Output:
0
Input:
850
Output:
45
Input:
-50
Output:
315
The output should be printed to the console.