#include <bits/stdc++.h>
using int64 = long long;
int main(void) {
  size_t n;
  while (std::cin >> n) {
    std::vector<int64> v(n);
    for (auto &x : v) {
      std::cin >> x;
    }
    std::string s;
    std::cin >> s;
    std::string ns;
    std::vector<int64> nv;
    for (size_t i = 0; i < n; i++) {
      if (i != 0 && s[i] == s[i - 1]) {
        nv.back() += v[i];
      } else {
        nv.push_back(v[i]);
        ns += s[i];
      }
    }
    s = std::move(ns);
    v = std::move(nv);
    int energy_speed = 1000;
    std::vector<size_t> water_pos;
    std::vector<size_t> grass_pos;
    size_t grass_pos_i = 0;
    int64 res = 0;
    for (size_t i = 0; i < v.size(); i++) {
      auto ground = s[i];
      auto length = v[i];
      if (ground == 'W') {
        energy_speed = std::min(energy_speed, 3);
        water_pos.push_back(i);
      } else if (ground == 'G') {
        energy_speed = std::min(energy_speed, 5);
        grass_pos.push_back(i);
      } else if (ground == 'L') {
        res += length;
        while (length != 0 && !water_pos.empty()) {
          auto dw = std::min(length, v[water_pos.back()]);
          length -= dw;
          v[water_pos.back()] -= dw;
          if (v[water_pos.back()] == 0) {
            water_pos.pop_back();
          }
          res += 3 * dw;
        }
        while (length != 0 && grass_pos_i < grass_pos.size()) {
          auto dg = std::min(length, v[grass_pos[grass_pos_i]]);
          length -= dg;
          v[grass_pos[grass_pos_i]] -= dg;
          if (v[grass_pos[grass_pos_i]] == 0) {
            grass_pos_i++;
          }
          res += 5 * dg;
        }
        res += energy_speed * length;
      }
    }
    int64 w = 0;
    for (size_t i = 0; i < v.size(); i++) {
      auto ground = s[i];
      auto length = v[i];
      if (ground == 'W') {
        w += length;
      } else if (ground == 'G') {
        auto dw = std::min(length, w);
        w -= dw;
        length -= dw;
        res += 4 * dw;
        res += length * 3;
      } else if (ground == 'L') {
      }
    }
    res += w * 2;
    std::cout << res << std::endl;
  }
  return 0;
}
