#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
long long a[N];
int n;
string s;
vector<int> v1, v2;
int add(vector<int>& v, char c) {
  while (!v.empty() && (a[v.back()] == 0 || s[v.back()] != c)) v.pop_back();
  return !v.empty();
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  cin >> s;
  long long sum = 0;
  v1.clear();
  v2.clear();
  for (int i = 0, f = 6; i < n; i++) {
    if (s[i] == 'W') f = 4;
    if (s[i] != 'L') {
      v1.push_back(i);
      v2.push_back(i);
      continue;
    }
    while (a[i]) {
      if (add(v1, 'W')) {
        long long mn = min(a[i], a[v1.back()]);
        a[i] -= mn;
        a[v1.back()] -= mn;
        sum += mn * 4;
      } else
        break;
    }
    while (a[i]) {
      if (add(v2, 'G')) {
        long long mn = min(a[i], a[v2.back()]);
        a[i] -= mn;
        a[v2.back()] -= mn;
        sum += mn * 6;
      } else
        break;
    }
    sum += f * a[i];
    a[i] = 0;
    v1.push_back(i);
    v2.push_back(i);
  }
  v1.clear();
  v2.clear();
  for (int i = 0; i < n; i++) {
    if (s[i] != 'G') {
      v1.push_back(i);
      v2.push_back(i);
      continue;
    }
    while (a[i]) {
      if (add(v1, 'W')) {
        long long mn = min(a[i], a[v1.back()]);
        a[i] -= mn;
        a[v1.back()] -= mn;
        sum += mn * 4;
      } else
        break;
    }
    while (a[i]) {
      if (add(v2, 'G')) {
        long long mn = min(a[i], a[v2.back()]);
        a[i] -= mn;
        a[v2.back()] -= mn;
        sum += mn * 6;
      } else
        break;
    }
    long long c = a[i] / 2;
    sum += 6 * c;
    a[i] -= 2 * c;
    if (a[i]) {
      sum += 3;
      a[i] = 0;
    }
    v1.push_back(i);
    v2.push_back(i);
  }
  v1.clear();
  v2.clear();
  for (int i = 0, j = 0, k = 0; i < n; i++) {
    if (s[i] != 'W') {
      v1.push_back(i);
      v2.push_back(i);
      continue;
    }
    while (a[i]) {
      if (add(v1, 'W')) {
        long long mn = min(a[i], a[v1.back()]);
        a[i] -= mn;
        a[v1.back()] -= mn;
        sum += mn * 4;
      } else
        break;
    }
    while (a[i]) {
      if (add(v2, 'G')) {
        long long mn = min(a[i], a[v2.back()]);
        a[i] -= mn;
        a[v2.back()] -= mn;
        sum += mn * 6;
      } else
        break;
    }
    v1.push_back(i);
    v2.push_back(i);
  }
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (a[i]) {
      cnt++;
      sum += 2 * a[i];
    }
  }
  if (cnt > 1)
    while (1)
      ;
  cout << sum << endl;
  return 0;
}
