func_code_string: #include <bits/stdc++.h>   using namespace std;   template <class T>   inline void checkMin(T& a, T b) {     if (b < a) a = b;   }   template <class T>   inline void checkMax(T& a, T b) {     if (b > a) a = b;   }   const int N = 22;   const long long INF = 1LL << 60;   int n, m, a[N], b[N];   long long dp[N][N], tmp[N][N], f[N][N], ans[N][N];   void DP(int n) {     for (int t = 0; t <= n; t++) {       for (int i = 0; i <= n; i++) dp[0][i] = INF;       dp[0][t] = 0;       for (int i = 1; i <= n; i++)         for (int j = 0; j <= n; j++) {           dp[i][j] = INF;           if (j > 0) checkMin(dp[i][j], dp[i - 1][j - 1] + a[i]);           if (j < n) checkMin(dp[i][j], dp[i - 1][j + 1] + b[i]);         }       for (int i = 0; i <= n; i++) f[t][i] = dp[n][i];     }   }   void fast_mult(int n, int m) {     for (int i = 0; i <= n; i++)       for (int j = 0; j <= n; j++) ans[i][j] = INF;     for (int i = 0; i <= n; i++) ans[i][i] = 0;     while (m > 0) {       if (m & 1) {         for (int i = 0; i <= n; i++)           for (int j = 0; j <= n; j++) tmp[i][j] = ans[i][j], ans[i][j] = INF;         for (int k = 0; k <= n; k++)           for (int i = 0; i <= n; i++)             for (int j = 0; j <= n; j++) checkMin(ans[i][j], tmp[i][k] + f[k][j]);       }       for (int i = 0; i <= n; i++)         for (int j = 0; j <= n; j++) tmp[i][j] = f[i][j], f[i][j] = INF;       for (int k = 0; k <= n; k++)         for (int i = 0; i <= n; i++)           for (int j = 0; j <= n; j++) checkMin(f[i][j], tmp[i][k] + tmp[k][j]);       m >>= 1;     }   }   int main() {     cin >> n >> m;     for (int i = 1; i <= n; i++) cin >> a[i];     for (int i = 1; i <= n; i++) cin >> b[i];     DP(n);     fast_mult(n, m);     cout << ans[0][0] << endl;     return 0;   }   