#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const long long inf = numeric_limits<long long>::max() / 2;
const long double eps = 1e-9;
const long double pi = acos(-1);
template <typename T>
inline bool mineq(T& a, T b) {
  return (a > b) ? (a = b, 1) : 0;
}
template <typename T>
inline bool maxeq(T& a, T b) {
  return (a < b) ? (a = b, 1) : 0;
}
inline void solve(), read();
const string file = "";
signed main() {
  if (file != "") {
    freopen((file + ".in").c_str(), "r", stdin);
    freopen((file + ".out").c_str(), "w", stdout);
  }
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  read();
  solve();
  return 0;
}
long long n;
vector<long long> a;
string s;
inline void solve() {
  long long time = 0;
  long double st = 0;
  long long was = 0;
  long double g = 0;
  for (long long i = 0; i < n; i++) {
    if (s[i] == 'G') {
      time += 5 * a[i];
      st += a[i];
      g += a[i];
    } else if (s[i] == 'W') {
      was = 1;
      time += 3 * a[i];
      st += a[i];
    } else if (s[i] == 'L') {
      time += a[i];
      st -= a[i];
    }
    if (st < 0) {
      long long coef = 3;
      if (!was) {
        coef = 5;
      }
      time += coef * (-st);
      st = 0;
    }
    mineq(g, st / 2.);
  }
  time -= 4. * g;
  time -= 2 * (st / 2. - g);
  cout << time << "\n";
}
inline void read() {
  cin >> n;
  a.resize(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  cin >> s;
}
