#include <bits/stdc++.h>
const int N = 1e5 + 5, Ref1[3] = {5, 3, 1}, Ref2[3] = {1, 3, 1};
int mp[N];
long long A[N];
inline long long read() {
  long long now = 0;
  register char c = getchar();
  for (; !isdigit(c); c = getchar())
    ;
  for (; isdigit(c); now = now * 10 + c - '0', c = getchar())
    ;
  return now;
}
int main() {
  int n = read();
  long long ans = 0;
  for (int i = 1; i <= n; ++i) ans += A[i] = read();
  register char c = getchar();
  while (c != 'W' && c != 'G' && c != 'L') c = getchar();
  mp[1] = c == 'L' ? 2 : c == 'W';
  for (int i = 2; i <= n; ++i) c = getchar(), mp[i] = c == 'L' ? 2 : c == 'W';
  long long W = 0, G = 0;
  for (int i = 1, cost = 5; i <= n; ++i) {
    if (!mp[i])
      G += A[i] << 1;
    else if (mp[i] == 1)
      W += A[i] << 1, cost = 3;
    long long rest = A[i], t;
    t = std::min(rest, W), rest -= t, ans += t, W -= t;
    t = std::min(rest, G), rest -= t, ans += t << 1, G -= t;
    ans += rest * cost;
  }
  printf("%I64d\n", ans);
  return 0;
}
