#include <bits/stdc++.h>
using namespace std;
int n, cost[100005];
long long dp[100005][2];
string s[100005][2];
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> cost[i];
  for (int i = 1; i <= n; ++i) {
    cin >> s[i][0];
    s[i][1] = s[i][0];
    reverse(s[i][1].begin(), s[i][1].end());
  }
  dp[1][1] = cost[1];
  for (int i = 2; i <= n; ++i) {
    for (int rev = 0; rev < 2; ++rev) {
      dp[i][rev] = 0x3f3f3f3f3f3f3f3f;
      if (dp[i - 1][0] < 0x3f3f3f3f3f3f3f3f && s[i - 1][0] <= s[i][rev])
        dp[i][rev] = min(dp[i][rev], dp[i - 1][0] + rev * cost[i]);
      if (dp[i - 1][1] < 0x3f3f3f3f3f3f3f3f && s[i - 1][1] <= s[i][rev])
        dp[i][rev] = min(dp[i][rev], dp[i - 1][1] + rev * cost[i]);
    }
  }
  long long sol = min(dp[n][0], dp[n][1]);
  printf("%I64d\n", (sol == 0x3f3f3f3f3f3f3f3f) ? -1 : sol);
  return 0;
}
