object Calc {
  def main(args : Array[String]): Unit = {
    val scanner = new java.util.Scanner(System.in)
    val input = scanner.nextLine().toInt
    println(input+input*input+input*input*input)
  }
}