#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t p, q;
  cin >> p >> q;
  int n;
  cin >> n;
  vector<int64_t> a;
  a.resize(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  while (*a.rbegin() == 1 && a.size() > 1) {
    *(a.rbegin() + 1) += 1;
    a.pop_back();
  }
  for (int i = 0; i < a.size(); ++i) {
    if (q == 0 || a[i] != p / q) {
      cout << "NO" << endl;
      return 0;
    }
    const auto pp = p;
    p = q;
    q = pp % q;
  }
  if (q != 0) {
    cout << "NO" << endl;
  } else {
    cout << "YES" << endl;
  }
}
