#!/bin/ruby def sumOfGroup(k) # Return the sum of the elements of the k'th group. index = (k*(k-1))/2 first_odd = index*2 + 1 total = 0 count = 0 k.times { total = total + first_odd+(2*count) count = count + 1 } return total end k = gets.strip.to_i answer = sumOfGroup(k) puts answer