var
  n, i, sum: integer;

begin
  readln(n);
  for i := 1 to n do
    sum := sum + 6 * i;
  writeln(sum);
end.