#include <bits/stdc++.h>
using namespace std;
int move(int i, vector<int> &a, vector<int> &b) {
if (i == a.size()) {
return 0;
}
return (a[i] * b[i]) + move(i + 1, a, b);
}
int main() {
int n;
cin >> n;
vector<int> a(n), b(n);
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
for (int i = 0; i < n; ++i) {
cin >> b[i];
}
if (move(0, a, b) == 0) {
cout << "Yes";
} else {
cout << "No";
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbW92ZShpbnQgaSwgdmVjdG9yPGludD4gJmEsIHZlY3RvcjxpbnQ+ICZiKSB7CiAgaWYgKGkgPT0gYS5zaXplKCkpIHsKICAgIHJldHVybiAwOwogIH0KCiAgcmV0dXJuIChhW2ldICogYltpXSkgKyBtb3ZlKGkgKyAxLCBhLCBiKTsKfQoKaW50IG1haW4oKSB7CiAgaW50IG47CiAgY2luID4+IG47CiAgdmVjdG9yPGludD4gYShuKSwgYihuKTsKICBmb3IgKGludCBpID0gMDsgaSA8IG47ICsraSkgewogICAgY2luID4+IGFbaV07CiAgfQogIGZvciAoaW50IGkgPSAwOyBpIDwgbjsgKytpKSB7CiAgICBjaW4gPj4gYltpXTsKICB9CgogIGlmIChtb3ZlKDAsIGEsIGIpID09IDApIHsKICAgIGNvdXQgPDwgIlllcyI7CiAgfSBlbHNlIHsKICAgIGNvdXQgPDwgIk5vIjsKICB9CiAgcmV0dXJuIDA7Cn0=