#include <bits/stdc++.h>
using namespace std;
long long a[100001];
char s[100001];
long long Compute(vector<int> &v, long long &x, int c) {
  if (v.empty() || x == 0) {
    return 0ll;
  }
  long long ans = 0;
  ++c;
  while (!v.empty() && x > 0) {
    int i = v.back();
    if (a[i] <= x) {
      ans += c * a[i];
      x -= a[i];
      a[i] = 0;
      v.pop_back();
    } else {
      ans += c * x;
      a[i] -= x;
      x = 0;
    }
  }
  return ans;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &a[i]);
  }
  scanf("%s", s);
  long long ans = 0;
  vector<int> grasses, waters;
  bool waterFound = false;
  for (int i = 1; i <= n; ++i) {
    char c = s[i - 1];
    if (c == 'G') {
      grasses.push_back(i);
      continue;
    }
    if (c == 'W') {
      waters.push_back(i);
      waterFound = true;
      continue;
    }
    ans += Compute(waters, a[i], 3);
    ans += Compute(grasses, a[i], 5);
    if (waterFound) {
      ans += 4 * a[i];
    } else {
      ans += 6 * a[i];
    }
    a[i] = 0;
  }
  waters.clear();
  grasses.clear();
  for (int i = 1; i <= n; ++i) {
    char c = s[i - 1];
    if (c == 'L') {
      continue;
    }
    if (c == 'W') {
      waters.push_back(i);
      continue;
    }
    ans += Compute(waters, a[i], 3);
    ans += 3 * a[i];
    a[i] = 0;
  }
  for (int i = 1; i <= n; ++i) {
    char c = s[i - 1];
    if (c == 'W') {
      ans += 2 * a[i];
      a[i] = 0;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
