func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int q;     cin >> q;     while (q--) {       int n;       cin >> n;       long long dp[n][3];       long long a[n], b[n];       for (int i = 0; i < n; i++) {         cin >> a[i] >> b[i];       }       for (int i = 0; i < n; i++) {         for (int j = 0; j < 3; j++) {           dp[i][j] = 2000000000000000000;         }       }       dp[0][0] = 0;       dp[0][1] = b[0];       dp[0][2] = 2 * b[0];       for (long long i = 1; i < n; i++) {         for (long long j = 0; j < 3; j++) {           for (long long k = 0; k < 3; k++) {             if (a[i] + j != a[i - 1] + k) {               dp[i][j] = min(dp[i][j], dp[i - 1][k] + j * b[i]);             }           }         }       }       cout << min(dp[n - 1][0], min(dp[n - 1][1], dp[n - 1][2])) <<   n ;     }   }   