#include <bits/stdc++.h>
using namespace std;
/* ループ処理 0からnまで*/
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main()
{
  int N;
  cin >> N;
  int sum = 0;
  vector<int> av, bv;
  rep(i, N)
  {
    int A;
    cin >> A;
    av.push_back(A);
  }
  rep(i, N)
  {
    int B;
    cin >> B;
    bv.push_back(B);
  }
  rep(i, N)
  {
    sum += av.at(i) * bv.at(i);
  }
  if (sum == 0)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
  return 0;
}
// dp[i][0] ---> no. of ways of x[0...i] to get y[i] = 0
//          ---> decision on x[i]
// dp[i][1] ---> no. of ways of x[0...i] to get y[i] = 1
//          ---> decision on x[i]
#include<bits/stdc++.h>
using namespace std;
#define ll long long

int main(){
  int n; cin >> n;
  vector<vector<ll>> dp(n+1, vector<ll>(2, 1));
  for(int i = 1; i <= n; i++){
    string s; cin >> s;
    if(s == "AND"){
      dp[i][0] = 2*dp[i-1][0] + dp[i-1][1];
      dp[i][1] = dp[i-1][1];
    }
    else{
      dp[i][0] = dp[i-1][0]; 
      dp[i][1] = dp[i-1][0] + 2*dp[i-1][1];
    }
  }
  cout << dp[n][1];
  return 0;
}