#include <bits/stdc++.h>
using namespace std;
long long l[100500];
char c[100500];
long long mn[100500];
long long ff[100500];
int32_t main() {
  std::iostream::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> l[i];
  for (int i = 0; i < n; i++) cin >> c[i];
  long long total_grass = 0;
  long long total_water = 0;
  bool waswater = false;
  long long fl = 0;
  long long ans = 0;
  long long last_zero = -1;
  for (int i = 0; i < n; i++) {
    if (c[i] == 'W') waswater = true;
    if (c[i] != 'L') {
      fl += l[i];
      ans += (c[i] == 'W' ? 3 : 5) * l[i];
    } else {
      if (fl >= l[i]) {
        fl -= l[i];
        if (fl == 0) {
          last_zero = i;
        }
        ans += l[i];
      } else {
        ans += (waswater ? 3 : 5) * (l[i] - fl);
        ans += l[i];
        fl = 0;
        last_zero = i;
      }
    }
    ff[i] = mn[i] = fl;
  }
  for (int i = n - 2; i >= last_zero + 1; i--) mn[i] = min(mn[i + 1], mn[i]);
  long long imp = 0;
  for (int i = last_zero + 1; i < n; i++) {
    if (c[i] != 'G') continue;
    long long can = min(2 * l[i], mn[i] - imp);
    can = min(can, ff[i] - imp);
    if (can >= 0) {
      imp += can;
      ans -= 2 * can;
    }
  }
  fl -= imp;
  if (fl > 0) {
    ans -= fl;
  }
  cout << ans;
  return 0;
}
