Integer Square
InterviewTime limit2sMemory limit512 MB
Given an integer area s, decide whether a square with integer-coordinate vertices can have that area, and if so output the four vertices.
- Level
Medium5 of 10
- Topics
- Math, Number theory, Geometry, Implementation
- Solved
- No attempts yet
Problem
Iris likes to draw different shapes on a grid paper. Her favorite shape is a square. She has recently tried to draw a square with area , but since she uses a grid paper, she wants all the vertices of the square to have integer coordinates.

Can you help her find such a square?
Input
The input contains a single integer ().
Output
If it is possible to construct the required square, output four pairs of integers: the coordinates of the vertices of the square, in any order. All coordinates should be in the range from to . If there are multiple answers, output any of them.
If it is impossible to construct the required square, print "Impossible".