#include <bits/stdc++.h>
using namespace std;
long long ans = 0, pos = 0, nw, res, n, l[100005], i, j, a[5], b[5], c[3],
          ty[100005], ch;
const long long inf = 2e18;
char s[100005];
void opt(long long p) {
  long long len;
  len = min(res, b[p]);
  b[p] -= len;
  res -= len;
  ans += len * a[p];
  if (nw == 1) b[0] += 2 * len;
  if (nw == 2) b[1] += 2 * len;
}
int main() {
  scanf("%I64d", &n);
  for (i = 1; i <= n; i++) scanf("%I64d", &l[i]), ans += l[i];
  scanf("%s", s);
  for (i = 0; i < n; i++) {
    if (s[i] == 'L') ty[i + 1] = 0;
    if (s[i] == 'G') ty[i + 1] = 2;
    if (s[i] == 'W') ty[i + 1] = 1;
  }
  a[0] = 1, a[1] = 2, a[2] = 3, a[3] = 5;
  c[0] = inf;
  c[1] = 1, c[2] = 2;
  pos = 1;
  nw = ty[1];
  res = l[1];
  while (pos <= n || res > 0) {
    if (nw == 1) b[2] = inf;
    if (nw == 2) b[3] = inf;
    for (i = 0; i < 4 && a[i] < c[nw]; i++) {
      if (b[i] > 0) {
        opt(i);
        goto tag;
      }
    }
    ans += res * c[nw];
    if (nw == 1) b[0] += res;
    if (nw == 2) b[1] += res;
    res = 0;
  tag:
    if (res == 0) res = l[++pos], nw = ty[pos];
  }
  printf("%I64d\n", ans);
  return 0;
}
