#include <bits/stdc++.h>
using namespace std;
const long long S = 1e5 + 6;
long long n, tot = 0, swim = 0, walk = 0, t = 0;
double ex;
long long l[S];
char s[S];
bool pd = 0;
long long cvt(char ch) {
  if (ch == 'W') {
    return 3;
  } else
    return 5;
}
int main() {
  scanf("%lld", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &l[i]);
  }
  scanf("%s", s + 1);
  for (int i = 1; i <= n; i++) {
    if (s[i] == 'L') {
      if (tot >= l[i]) {
        tot -= l[i];
        t += l[i];
      } else {
        if (pd) {
          t += 3 * (l[i] - tot);
        } else
          t += 5 * (l[i] - tot);
        t += l[i];
        tot = 0;
      }
    } else {
      tot += l[i];
      t += l[i] * cvt(s[i]);
      if (s[i] == 'W') {
        pd = 1;
        swim += l[i] * 2;
      } else
        walk += l[i] * 2;
    }
    walk = min(walk, tot);
  }
  if (tot >= walk) {
    t -= walk * 2;
    t -= (tot - walk);
  } else {
    t -= tot * 2;
  }
  printf("%lld\n", t);
  fclose(stdin);
  fclose(stdout);
}
