K = int(input()) print(2 * K + 2 + (8 * K - 4) * (K) // 2)