if __name__ == '__main__': n = int(input().strip()) print(n * ((n * (n - 1) + 1) + n - 1))