#include <bits/stdc++.h>
using namespace std;
int n;
vector<long long> len;
string field;
bool seenWater = false;
deque<int> water;
deque<int> grass;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    long long x;
    cin >> x;
    len.push_back(x);
  }
  cin >> field;
  long long res = 0;
  for (int i = 0; i < n; ++i) {
    if (field[i] == 'L') {
      res += len[i];
      while (water.size() > 0 && len[i] > 0) {
        if (len[water.back()] > len[i]) {
          res += 3 * len[i];
          len[water.back()] -= len[i];
          len[i] = 0;
        } else {
          res += len[water.back()] * 3;
          len[i] -= len[water.back()];
          water.pop_back();
        }
      }
      while (grass.size() > 0 && len[i] > 0) {
        if (len[grass.front()] > len[i]) {
          res += 5 * len[i];
          len[grass.front()] -= len[i];
          len[i] = 0;
        } else {
          res += len[grass.front()] * 5;
          len[i] -= len[grass.front()];
          grass.pop_front();
        }
      }
      if (len[i] > 0) {
        if (seenWater) {
          res += 3 * len[i];
        } else {
          res += 5 * len[i];
        }
      }
    } else if (field[i] == 'W') {
      seenWater = true;
      water.push_back(i);
    } else if (field[i] == 'G') {
      grass.push_front(i);
    }
  }
  reverse(grass.begin(), grass.end());
  for (int i = grass.size() - 1; i >= 0; --i) {
    while (water.size() > 0 && water.back() > grass[i]) {
      res += 2 * len[water.back()];
      water.pop_back();
    }
    while (water.size() > 0 && len[grass[i]] > 0) {
      if (len[water.back()] > len[grass[i]]) {
        res += 4 * len[grass[i]];
        len[water.back()] -= len[grass[i]];
        len[grass[i]] = 0;
      } else {
        res += len[water.back()] * 4;
        len[grass[i]] -= len[water.back()];
        water.pop_back();
      }
    }
  }
  for (auto x : grass) res += 3 * len[x];
  for (auto x : water) res += 2 * len[x];
  cout << res << endl;
  return 0;
}
