#!/bin/python3

import sys

def sumOfGroup(k):
    # Return the sum of the elements of the k'th group.
    #first odd element: k(k-1) + 1
    el = k*(k-1) + 1
    res = k*el
    res += k*(k-1)
    return res

if __name__ == "__main__":
    k = int(input().strip())
    answer = sumOfGroup(k)
    print(answer)