func_code_string: #include <bits/stdc++.h>   using namespace std;   const int inf = 1e9;   inline void gmx(long long &x, long long y) {     if (x < y) x = y;   }   inline void gmn(long long &x, long long y) {     if (x > y) x = y;   }   inline int read() {     char c = getchar();     int z = 0, f = 1;     while (c !=  -  && (c >  9  || c <  0 )) c = getchar();     if (c ==  - ) f = -1, c = getchar();     while (c >=  0  && c <=  9 ) z = (z << 1) + (z << 3) + c -  0 , c = getchar();     return z * f;   }   const int N = 1e4 + 5;   int n, c, p[N], s[N];   long long f[2][N], ans = 1e18;   int main() {     n = read();     c = read();     for (int i = 1; i <= n; i++) p[i] = read();     for (int i = 1; i <= n; i++) s[i] = read();     for (int i = 1; i <= n; i++) {       int o = i & 1;       memset(f[o], 0x3f, sizeof(f[o]));       f[o][0] = f[o ^ 1][0] + p[i];       for (int j = 1; j <= i; j++)         f[o][j] = min(f[o ^ 1][j] + 1ll * c * j + p[i], f[o ^ 1][j - 1] + s[i]);     }     for (int i = 0; i <= n; i++) gmn(ans, f[n & 1][i]);     cout << ans;     return 0;   }   