#include <iostream>
using namespace std;

int main()
{
    int T;
    while (cin >> T)
    {
        for (int i = 1; i <= T; i++)
        {
            int n;
            cin >> n;
            cout << 2 * n*n - n + 1 << endl;
        }
    }
}

太难,百度一下