# require "template"
lib C
  fun strtoll(s : UInt8*, p : UInt8**, b : Int32) : Int64
end

class String
  def to_i64
    C.strtoll(self, nil, 10)
  end
end

def sum(first, diff, count)
  last = first + diff * ~-count
  (first + last) * count // 2
end

n = read_line.to_i64
puts sum(1i64, 2i64, n + 1) +
     sum(2i64, 1i64, n) +
     sum(1i64, 1i64, n - 2) +
     sum(2i64, 2i64, n - 1) * 2