#include <bits/stdc++.h>
long long N;
long long V[100005];
std::string Path;
void Citire() {
  std::cin >> N;
  for (long long i = 0; i < N; ++i) std::cin >> V[i];
  std::cin >> Path;
}
void Rezolvare() {
  bool bHadWater = false;
  long long Time = 0, Stamina = 0, TwiceGrass = 0;
  for (long long i = 0; i < N; ++i) {
    if (Path[i] == 'L') {
      Time += V[i];
      Stamina -= V[i];
      if (Stamina < 0) Time -= Stamina * (bHadWater ? 3 : 5), Stamina = 0;
    } else if (Path[i] == 'W') {
      bHadWater = true;
      Stamina += V[i];
      Time += 3 * V[i];
    } else {
      Stamina += V[i];
      Time += 5 * V[i];
      TwiceGrass += 2 * V[i];
    }
    TwiceGrass = std::min(TwiceGrass, Stamina);
  }
  if (Stamina > 0)
    Time -= 4 * TwiceGrass / 2, Time -= 2 * (Stamina - TwiceGrass) / 2;
  std::cout << Time << '\n';
}
int main() {
  Citire();
  Rezolvare();
  return 0;
}
