func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}
func main() {
    let a = Double(readInts()[0])
    print(Int(a + pow(a, 2) + pow(a, 3)))
//    print(a)
    
}
main()