#include <bits/stdc++.h>
using namespace std;
template <typename T>
T Abs(T first) {
  return (first < 0 ? -first : first);
}
template <typename T>
T Sqr(T first) {
  return (first * first);
}
string plural(string s) {
  return (int((s).size()) && s[int((s).size()) - 1] == 'x' ? s + "en"
                                                           : s + "s");
}
const int INF = (int)1e9;
const long double EPS = 1e-12;
const long double PI = acos(-1.0);
bool Read(int &first) {
  char c, r = 0, n = 0;
  first = 0;
  for (;;) {
    c = getchar();
    if ((c < 0) && (!r)) return (0);
    if ((c == '-') && (!r))
      n = 1;
    else if ((c >= '0') && (c <= '9'))
      first = first * 10 + c - '0', r = 1;
    else if (r)
      break;
  }
  if (n) first = -first;
  return (1);
}
bool ReadLL(long long &first) {
  char c, r = 0, n = 0;
  first = 0;
  for (;;) {
    c = getchar();
    if ((c < 0) && (!r)) return (0);
    if ((c == '-') && (!r))
      n = 1;
    else if ((c >= '0') && (c <= '9'))
      first = first * 10 + c - '0', r = 1;
    else if (r)
      break;
  }
  if (n) first = -first;
  return (1);
}
long long L[200005];
char S[200005];
int main() {
  if (0) freopen("in.txt", "r", stdin);
  int N, M, K;
  int i, j, k, a, b, c, first, second, z;
  Read(N);
  for (i = 0; i < N; i++) ReadLL(L[i]);
  scanf("%s", &S);
  long long ans = 0;
  long long sg1 = 0, sg2 = 0, sw = 0;
  bool w = 0;
  for (i = 0; i < N; i++) {
    long long d = L[i], m;
    if (S[i] == 'W') {
      w = 1;
      ans += d * 3;
      sw += d;
    } else if (S[i] == 'G') {
      ans += d * 5;
      m = min(sw - sg2, d);
      sg2 += m, d -= m;
      sg1 += d;
    } else {
      if (sg1 + sg2 + sw >= d) {
        ans += d;
        m = min(sw, d);
        sw -= m, d -= m;
        m = min(sg1, d);
        sg1 -= m, d -= m;
        sg2 -= d;
        if (sg2 > sw) {
          m = sg2 - sw;
          sg2 -= m;
          sg1 += m;
        }
      } else {
        long long ex = d - (sg1 + sg2 + sw);
        ans += d + ex * (w ? 3 : 5);
        sg1 = sg2 = sw = 0;
      }
    }
  }
  ans -= sg1 * 2 + sg2 * 3 + sw;
  cout << ans << endl;
  return (0);
}
