#include <bits/stdc++.h>   using namespace std;   const long long OO = 1e8;   const double EPS = (1e-7);   int dcmp(double x, double y) { return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1; }   const int N = 100;   bool adjMatrixBool[N][N];   int adjMatrix[N][N];   vector<int> adjMatrixAll[N][N];   map<pair<int, int>, int> adjMatrixMap;   vector<vector<int> > adjList1;   vector<vector<pair<int, int> > > adjList2;   vector<bool> visited;   bool valid(int i, int j) { return 1; }   char arr[303][303], x, b;   bool prime(long long n) {     long long i;     for (i = 2; i <= sqrt(n); i++) {       if (n % i == 0) return false;     }     return true;   }   long long gcd(long long a, long long b) {     if (b == 0) return a;     return gcd(b, a % b);   }   long long lcm(long long a, long long b) { return (a / gcd(a, b) * b); }   int main() {     ios_base::sync_with_stdio(false);     long long n;     cin >> n;     string s;     cin >> s;     long long arr[n];     for (int i = 0; i < n; i++) {       cin >> arr[i];     }     long long ans = INT_MAX;     for (int i = 0; i < n - 1; i++) {       if (s[i] ==  R  and s[i + 1] ==  L )         ans = min(ans, abs((arr[i + 1] - arr[i]) / 2));     }     if (ans == INT_MAX)       cout <<  -1  << endl;     else       cout << ans;     return 0;   }   