with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;

procedure Solve is
   A : Integer;
   Ans : Integer;
begin
   Get (A);
   Ans := A+A*A+A*A*A;
   Put_Line (Integer'Image (Ans));
end Solve;