#直接使用等差数列求和公式 while True: try: n = int(input()) s = n * 2 + (n * (n - 1))//2 * 3 print(s) except: break