#include <bits/stdc++.h>   using namespace std;   int a[100010];   char b[100010];   int main() {     int n, ansl = -1e9, ansr = 1e9, l1 = -1e9, l2 = -1e9;     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %d , &a[i]);     }     scanf( %s , b + 1);     for (int i = 5; i <= n; i++) {       if (b[i] ==  1 ) {         if (b[i - 1] ==  0 ) {           l1 = max(l1, max(a[i], max(max(a[i - 1], a[i - 2]),                                      max(a[i - 3], a[i - 4]))) +                            1);         }         if (b[i - 1] ==  1  && b[i - 2] ==  1  && b[i - 3] ==  1  &&             b[i - 4] ==  1 ) {           l2 = max(l2, min(a[i], min(min(a[i - 1], a[i - 2]),                                      min(a[i - 3], a[i - 4]))));         }       }     }     printf( %d %d n , l1, max(l1, l2));     return 0;   }   