#include #include #include #include using namespace std; typedef long long ll; template < typename T > T gcd (T a , T b) { if (a < b) swap(a , b); if (a % b == 0) return b; else return gcd (b , a % b); } template < typename T > T lcm (T a , T b) { return (a / gcd (a , b) * b); } int main () { ll x , y; cin >> x >> y; ll lc = lcm(x , y); int n; cin >> n; vector a(n + 1); for (int i = 1; i <= n; i++) { cin >> a[i]; a[i] *= lc; } ll pos = 0; for (int i = 1; i < n; i++) { pos += (a[i] - a[i - 1]) * y / x; if (pos > a[i + 1]) { cout << "NO" << endl; return 0; } } cout << "YES" << endl; return 0; }