#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int N;
long double L[100005];
string S;
bool W = false, G = false;
long long stamina = 0;
long double swam = 0, walked = 0;
long long T = 0;
void convertWater(int i, char C) {
  if (swam * 2 <= L[i]) {
    L[i] -= swam * 2;
    T += swam * 4;
    if (C == 'G') walked += swam * 2;
    swam = 0;
  } else {
    swam -= (L[i] / 2);
    T += (L[i] / 2) * 4;
    if (C == 'G') walked += L[i];
    L[i] = 0;
  }
}
void convertGrass(int i) {
  if (walked * 2 <= L[i]) {
    L[i] -= walked * 2;
    T += walked * 6;
    walked = 0;
  } else {
    walked -= (L[i] / 2);
    T += (L[i] / 2) * 6;
    L[i] = 0;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> N;
  for (int i = 0; i < N; i++) cin >> L[i];
  cin >> S;
  for (int i = 0; i < N; i++) {
    assert(stamina <= 1);
    L[i] -= stamina;
    T += stamina;
    swam += stamina;
    stamina = 0;
    if (S[i] == 'W') W = true;
    if (S[i] == 'G') G = true;
    if (S[i] == 'L') {
      convertWater(i, S[i]);
      convertGrass(i);
      if (W)
        T += L[i] * 4;
      else
        T += L[i] * 6;
    } else if (S[i] == 'W') {
      T += L[i] * 2;
      swam += L[i] / 2;
    } else {
      if (W) convertWater(i, S[i]);
      T += L[i] * 3;
      walked += (L[i] / 2);
    }
  }
  cout << T << endl;
  return 0;
}
