#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
const long long int mod = 1000000007;
const long long int big = 2.19e18 + 1;
const long double pai = 3.141592653589793238462643383279502884197;
const long double eps = 1e-15;
template <class T, class U>
bool mineq(T& a, U b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T, class U>
bool maxeq(T& a, U b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
long long int gcd(long long int a, long long int b) {
  if (a % b == 0) {
    return b;
  } else
    return gcd(b, a % b);
}
long long int lcm(long long int a, long long int b) {
  if (a == 0) {
    return b;
  }
  return a / gcd(a, b) * b;
}
template <class T>
void SO(T& ve) {
  sort(ve.begin(), ve.end());
}
template <class T>
void REV(T& ve) {
  reverse(ve.begin(), ve.end());
}
template <class T>
long long int LBI(vector<T>& ar, T in) {
  return lower_bound(ar.begin(), ar.end(), in) - ar.begin();
}
template <class T>
long long int UBI(vector<T>& ar, T in) {
  return upper_bound(ar.begin(), ar.end(), in) - ar.begin();
}
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int i, n;
  cin >> n;
  vector<long long int> L(n);
  for (i = 0; i < n; i++) {
    cin >> L[i];
  }
  string str;
  cin >> str;
  long long int Wp = 0, Gp = 0, ans = 0;
  bool iW = 0;
  for (i = 0; i < n; i++) {
    if (str[i] == 'G') {
      ans += L[i] * 5;
      Gp += L[i];
      long long int ch = min(Wp, L[i]);
      Wp -= ch;
      Gp += ch;
    } else if (str[i] == 'W') {
      ans += L[i] * 3;
      Wp += L[i];
      iW = 1;
    } else {
      ans += L[i];
      long long int nL = L[i];
      long long int uW = min(nL, Wp);
      Wp -= uW;
      nL -= uW;
      long long int uG = min(nL, Gp);
      Gp -= uG;
      nL -= uG;
      if (iW) {
        ans += nL * 3;
      } else {
        ans += nL * 5;
      }
    }
  }
  ans -= Wp + Gp * 2;
  cout << ans << endl;
  return 0;
}
