#include <bits/stdc++.h>
using namespace std;
long long int f[1000];
long long int ind = 0;
long long int p, q;
void to_frac() {
  while (q > 0) {
    f[ind] = p / q;
    long long int tmp = q;
    q = p % q;
    p = tmp;
    ind++;
  }
}
long long int cmp[100];
int main() {
  cin >> p >> q;
  to_frac();
  int k;
  cin >> k;
  for (int i = 0; i < k; i++) cin >> cmp[i];
  if (cmp[k - 1] == 1 && k > 1) {
    cmp[k - 2]++;
    k--;
  }
  if (ind != k) {
    cout << "NO\n";
    return 0;
  }
  for (int i = 0; i < k; i++) {
    if (f[i] != cmp[i]) {
      cout << "NO\n";
      return 0;
    }
  }
  cout << "YES\n";
}
