while(line = readline()) {
    const num = parseInt(line);
    let total = 0;
    for (let i = 2; i <= 2 + 3*(num-1); i = i+3) {
        total += i;
    }
    print(total);
}