#include <bits/stdc++.h>
using namespace std;
int n;
long long a[1000010];
char s[100010];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%lld", &a[i]);
  scanf("%s", s);
  long long time = 0, energy = 0, grass = 0;
  int water = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'L') {
      time += a[i];
      energy -= a[i];
      if (energy < 0) {
        if (water)
          time += (-energy) * 3;
        else
          time += (-energy) * 5;
        energy = 0;
      }
    } else if (s[i] == 'W') {
      water = 1;
      time += 3 * a[i];
      energy += a[i];
    } else if (s[i] == 'G') {
      time += 5 * a[i];
      energy += a[i];
      grass += 2 * a[i];
    }
    grass = min(grass, energy);
  }
  if (energy > 0) {
    time -= (5 - 1) * grass / 2;
    time -= (3 - 1) * (energy - grass) / 2;
  }
  printf("%lld\n", time);
  return (0);
}
