#include <bits/stdc++.h>
using namespace std;
const int maxn = 100007;
int n, ty[maxn];
long long ll[maxn], rr[maxn];
char s[maxn];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    long long x;
    scanf("%lld", &x);
    ll[i] = rr[i - 1] + 1;
    rr[i] = ll[i] + x - 1;
  }
  scanf("%s", s + 1);
  int ok = 0;
  long long ans = 0, res = 0, p1 = 0, p2 = 0;
  for (int i = 1; i <= n; i++) {
    long long x = rr[i] - ll[i] + 1;
    if (s[i] == 'L') {
      if (res < x) {
        ans += (ok ? 3LL : 5LL) * (x - res);
        res = x;
      }
      res -= x;
      ans += x;
    } else if (s[i] == 'W') {
      ok = 1;
      ans += 3 * x;
      res += x;
    } else {
      ans += 5 * x;
      res += x;
      p1 += 2 * x;
    }
    p1 = min(p1, res);
  }
  ans -= p1 * 2;
  ans -= (res - p1);
  printf("%lld", ans);
  return 0;
}
