#include <bits/stdc++.h>
using namespace std;
long long p, q;
long long n;
bool match(long long p, long long q, long long i, vector<long long>& a) {
  int bits_q = (int)ceil(log10(q + 1.0) / log10(2.0));
  int bits_a = (int)ceil(log10(a[i] + 1.0) / log10(2.0));
  if (bits_q + bits_a > 64) return false;
  if (p <= 0 || q <= 0) return false;
  if (i == n) return (q * a[n] == p);
  return match(q, p - q * a[i], i + 1, a);
}
int main() {
  cin >> p >> q;
  cin >> n;
  vector<long long> a(n + 1);
  for (long long i = 1; i <= n; i++) cin >> a[i];
  if (match(p, q, 1, a))
    cout << "YES\n";
  else
    cout << "NO\n";
}
