read n echo $[1%n-(~n**3+~n*2)/6-2]