#include <bits/stdc++.h>   using namespace std;   const int M = 1e5 + 5;   int A[M];   char B[M];   int main() {     int n;     scanf( %d , &n);     for (int j = 0; j < n; j++) scanf( %d , &A[j]);     scanf( %s , B);     int cnt = 0;     for (int j = 0; j < n; j++)       if (B[j] ==  1 ) cnt += A[j];     int ans = cnt, sum = 0, sum1 = 0;     for (int j = 0; j < n; j++) {       if (B[j] ==  1 ) {         ans = max(ans, cnt - A[j] + sum1 - sum);         sum += A[j];       }       sum1 += A[j];     }     printf( %d n , ans);     return 0;   }   