N = gets.to_i D = gets.split.map(&:to_i) W = gets.split.map(&:to_i) E = Hash.new { |h, k| h[k] = {} } O = Hash.new(false) D.each_with_index do |d, i| u = (i + d) % N v = (i - d) % N O[u] = true if u == v E[u][v] = true E[v][u] = true end visited = Hash.new(false) all_ok = true N.times do |u| next if visited[u] queue = [] queue << u ura_cnt = 0 one = false until queue.empty? u = queue.shift next if visited[u] visited[u] = true ura_cnt += 1 if W[u] == 0 one = true if O[u] E[u].each_key do |v| queue << v end end if ura_cnt.odd? && !one all_ok = false end end if all_ok puts 'Yes' else puts 'No' end