~/algor $ cat problems/if-grafikdagi-funksiya
Function from a graph
Easy
1000 ms
64 MB
21%
An integer $x$ is given. Compute the value of the piecewise function:
$$f(x) = \begin{cases} -2 * x - 2, & \text{if } x < -2 \\ x^{2} - 2, & \text{if } -2 \le x \le 2 \\ 2 * x - 2, & \text{if } x > 2 \end{cases}$$
Input
One integer $x$.
Output
One integer — the value $f(x)$.
Note
$-10^{6} \le x \le 10^{6}$
Examples
Input #1
-3
Output #1
4
Input #2
1
Output #2
-1