#pragma region Macros
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define REP2(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; ++i)
#define REP3(i, l, r) for (int i = (l), i##_len = (int)(r); i < i##_len; ++i)
#define GET_MACRO_REP(_1, _2, _3, NAME, ...) NAME
#define REP(...) GET_MACRO_REP(__VA_ARGS__, REP3, REP2) (__VA_ARGS__)
#define RREP2(i, n) for (int i = (n - 1); i >= 0; --i)
#define RREP3(i, l, r) for (int i = (r - 1), i##_len = (l); i >= i##_len; --i)
#define GET_MACRO_RREP(_1, _2, _3, NAME, ...) NAME
#define RREP(...) GET_MACRO_REP(__VA_ARGS__, RREP3, RREP2) (__VA_ARGS__)
#define IN(type, n) type n; cin >> n
#define INALL(v) for (auto &e : v) { cin >> e; }
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

#ifdef _DEBUG
#define DEBUG(x) cout << #x << ": " << x << endl
#else
#define DEBUG(x)
#endif

template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
void yes() { cout << "Yes" << endl; }
void no() { cout << "No" << endl; }
#pragma endregion

int main() {
  IN(ll, N);
  vector<ll> As(N);
  vector<ll> Bs(N);
  INALL(As);
  INALL(Bs);

  ll ans = 0;
  REP(i, N) {
    ans += As.at(i) * Bs.at(i);
  }

  if (ans == 0) yes();
  else no();

  return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for (ll i = 0; i < ll(n); i++)
#define REPE(i, l, n) for (ll i = l; i <= ll(n); i++)
#define FORA(i, I) for (const auto& i : I)
#define ALL(v) v.begin(), v.end()
#define UQ(v) v.erase(unique(ALL(v)), v.end())
#define ACM(v) accumulate(ALL(v), 0LL)
#define C cin >>
#define P(str) cout << str << endl
#define VLL vector<ll>
#define chmax(a, b) a = (((a) < (b)) ? (b) : (a))
#define chmin(a, b) a = (((a) > (b)) ? (b) : (a))
const long long INF = 1100000000000000000;
int main() {
    ll x, y, a, b;
    C x >> y >> a >> b;
    ll ans = 0;
    while (true) {
        if (x > (x + b) / a || x >= y / a) {
            break;
        }
        x *= a;
        ans++;
    }
    ans += (y - 1 - x) / b;
    cout << ans << endl;
}