#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int t; cin >> t;
    for (; t; --t) {
        int n, m; cin >> n >> m;
        vector<int> arr(m);
        for (int i = 0; i < m; ++i) {
            cin >> arr[i];
        }
        int ans = n * arr[0];
        if ((m - n + 1) % 2 == 0) ans -= arr[0];
        cout << ans << "\n";
    }
    return 0;
}
