#include <bits/stdc++.h>
using namespace std;
const int N = 100003;
const int M = N << 1;
int n;
long long a[N];
long double v, w, g, ans;
int bw, bg;
char c[N];
void read(int &x) {
  char ch = getchar();
  x = 0;
  int w = 0;
  for (; ch < '0' || ch > '9'; ch = getchar()) w |= (ch == '-');
  for (; ch >= '0' && ch <= '9'; ch = getchar())
    x = (x << 3) + (x << 1) + ch - '0';
  if (w) x = -x;
}
void read(long long &x) {
  char ch = getchar();
  x = 0;
  int w = 0;
  for (; ch < '0' || ch > '9'; ch = getchar()) w |= (ch == '-');
  for (; ch >= '0' && ch <= '9'; ch = getchar())
    x = (x << 3) + (x << 1) + ch - '0';
  if (w) x = -x;
}
void luangao() {
  long double vv = min(-v / 2, w);
  v += vv * 2;
  w -= vv;
  ans += 2 * vv;
  vv = min(-v / 2, g);
  v += vv * 2;
  g -= vv;
  ans += 4 * vv;
  if (v < 0) {
    if (bw)
      ans += -v * 3;
    else if (bg)
      ans += -v * 5;
    else
      assert(0);
    v = 0;
  }
}
int main() {
  read(n);
  for (int i = (1); i <= (n); i++) read(a[i]);
  scanf("%s", c + 1);
  for (int i = (1); i <= (n); i++) {
    v -= a[i];
    ans += a[i];
    if (c[i] == 'G') g += a[i], bg = 1;
    if (c[i] == 'W') w += a[i], bw = 1;
    if (v < 0) luangao();
  }
  assert(v == 0);
  cout << (long long)ans << endl;
  return 0;
}
