package me.yukicoder.lv1; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class No0216 { public static void main(String[] args) { try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) { int cnt = Integer.parseInt(br.readLine()); String[] a = br.readLine().split(""); String[] b = br.readLine().split(""); int[] score = new int[cnt]; int[] cntSolved = new int[cnt]; int sumScore = 0; int kScore = 0; for (int i = 0; i < cnt; i++) { score[i] = Integer.parseInt(a[i]); cntSolved[i] = Integer.parseInt(b[i]); sumScore += score[i]; kScore += cntSolved[i] == 0 ? score[i] : 0; } System.out.println((sumScore / 2) <= kScore ? "YES" : "NO"); } catch (IOException e) { e.printStackTrace(); } } }