#include <bits/stdc++.h>
using namespace std;
template <class T, class R>
T max(const T &__X, const R &__Y) {
  return __X > __Y ? __X : __Y;
}
template <class T, class R>
T min(const T &__X, const R &__Y) {
  return __X < __Y ? __X : __Y;
}
template <class T, class R>
void maximize(T &__X, R __Y) {
  __X = __X > __Y ? __X : __Y;
}
template <class T, class R>
void minimize(T &__X, R __Y) {
  __X = __X < __Y ? __X : __Y;
}
template <class T>
int getBit(T &__X, int __i) {
  return ((__X >> __i) & 1) == 1;
}
template <class T>
bool inRange(T __L, T __R, T __X) {
  return __L <= __X && __X <= __R;
}
template <class T>
T __abs(T __X) {
  return (__X < 0) ? -__X : __X;
}
template <class T>
T __sqr(T __X) {
  return __X * __X;
}
template <class T>
inline void scan(T &__ret) {
  __ret = T();
  char c = 0;
  bool neg = 0;
  while (isdigit(c) == 0 && c != '-') c = getchar();
  if (c == '-') {
    neg = 1;
    c = getchar();
  }
  for (; isdigit(c) != 0; c = getchar()) __ret = __ret * 10 + c - '0';
  __ret = (neg) ? -__ret : __ret;
}
template <class T>
void print(T __X) {
  if (__X < 0) {
    putchar('-');
    __X *= -1;
  }
  if (__X > 9) print(__X / 10);
  putchar(__X % 10 + '0');
}
string s;
vector<long long> a;
int n;
void FileInit() {
  {
    freopen(
        ""
        ".inp",
        "r", stdin);
    freopen(
        ""
        ".out",
        "w", stdout);
  }
}
void FileDebug() {
  {
    freopen(
        ""
        ".inp",
        "r", stdin);
    freopen(
        ""
        ".out",
        "w", stdout);
  }
}
void FileClose() {
  fclose(stdin);
  fclose(stdout);
}
void Enter() {
  cin >> n;
  a = vector<long long>(n, 0LL);
  for (long long &x : a) cin >> x;
  cin >> s;
}
void Solve() {
  long long lenGrass = 0LL, currStam = 0LL, Time = 0LL;
  bool hadWater = 0;
  for (auto i = 0; i < n; ++i) {
    if (s[i] == 'L') {
      Time += a[i];
      currStam -= a[i];
      if (currStam < 0) {
        Time -= (5 - 2 * hadWater) * currStam;
        currStam = 0LL;
      }
    } else if (s[i] == 'W') {
      hadWater = 1;
      currStam += a[i];
      Time += 3 * a[i];
    } else if (s[i] == 'G') {
      currStam += a[i];
      Time += 5 * a[i];
      lenGrass += a[i] * 2;
    }
    minimize(lenGrass, currStam);
  }
  if (currStam) {
    Time -= 2 * lenGrass;
    Time -= currStam - lenGrass;
  }
  cout << Time << '\n';
}
int main() {
  Enter();
  Solve();
  return 0;
}
