func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxp = 22;   const long double EPS = 1e-18;   const long long INF = 2e18;   const int MOD = 1e9 + 7;   const int N = 2e5 + 1;   string s, t =  hard ;   long long dp[N][4];   long long arr[N];   int n;   long long solve(int x, int idx) {     if (idx == 4) return INF;     if (x == n) return 0;     if (dp[x][idx] != -1) return dp[x][idx];     int nxt = idx;     if (s[x] == t[idx]) nxt++;     return dp[x][idx] = min(solve(x + 1, idx) + arr[x], solve(x + 1, nxt));   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     cin >> n >> s;     int i, j;     for (i = 0; i < n; i++) cin >> arr[i];     for (i = 0; i < n; i++)       for (j = 0; j < 4; j++) dp[i][j] = -1;     cout << solve(0, 0) <<   n ;   }   