#include <bits/stdc++.h>
using namespace std;
long long a[100010], x, y, sum;
char s[100010];
int n, flag;
void Water(int k) {
  sum = sum + 2 * a[k];
  x = x + a[k];
  flag = 1;
}
void Grass(int k) {
  if (x >= a[k]) {
    sum = sum + 2 * a[k];
    x = x - a[k];
    y = y + 2 * a[k];
  } else {
    sum = sum + 2 * x;
    y = y + 2 * x;
    a[k] = a[k] - x;
    x = 0;
    sum = sum + a[k] * 3;
    y = y + a[k];
  }
}
void Lava(int k) {
  if (x >= a[k]) {
    sum = sum + 2 * a[k];
    x = x - a[k];
  } else {
    sum = sum + 2 * x;
    a[k] = a[k] - x;
    x = 0;
    if (y >= a[k]) {
      sum = sum + a[k] * 3;
      y = y - a[k];
    } else {
      sum = sum + y * 3;
      a[k] = a[k] - y;
      y = 0;
      if (flag)
        sum = sum + a[k] * 4;
      else
        sum = sum + a[k] * 6;
    }
  }
}
int main() {
  x = 0, y = 0, sum = 0, flag = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  scanf("%s", s + 1);
  for (int i = 1; i <= n; i++) {
    if (s[i] == 'W') Water(i);
    if (s[i] == 'G') Grass(i);
    if (s[i] == 'L') Lava(i);
  }
  printf("%lld\n", sum);
}
