func_code_string: #include <bits/stdc++.h>   using namespace std;   inline void re(int &x) {     x = 0;     bool flag = false;     char c = getchar();     while (c <  0  || c >  9 ) {       flag = c ==  - ;       c = getchar();     }     while (c >=  0  && c <=  9 ) {       x = (x << 1) + (x << 3) + (c ^  0 );       c = getchar();     }     if (flag) x = -x;     return;   }   long long l[100010];   int n;   char s[100010];   int main() {     long long W = 0, G = 0, mn = 5;     long long S = 0;     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %I64d , &l[i]);       l[i] *= 2;       S += l[i];     }     scanf( %s , s + 1);     for (int i = 1; i <= n; i++) {       if (s[i] ==  G ) G += l[i];       if (s[i] ==  W ) {         W += l[i];         mn = 3;       }       long long t = l[i];       long long e;       e = min(t / 2, W);       S += 2 * e;       t -= 2 * e;       W -= e;       e = min(t / 2, G);       S += 4 * e;       t -= 2 * e;       G -= e;       S += t * mn;     }     printf( %I64d n , S / 2);     return 0;   }   