#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;
const long long INFLL = 1001001001001001001LL;
template <typename T>
void pv(T a, T b) {
  for (T i = a; i != b; ++i) cout << *i << " ";
  cout << endl;
}
template <typename T>
void chmin(T& a, T b) {
  if (a > b) a = b;
}
template <typename T>
void chmax(T& a, T b) {
  if (a < b) a = b;
}
long long gcd(long long m, long long n) { return n ? gcd(n, m % n) : m; }
int main() {
  long long p, q;
  cin >> p >> q;
  int n;
  long long A[100];
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> A[i];
  }
  if (n >= 2 && A[n - 1] == 1) {
    ++A[n - 2];
    --n;
  }
  long long g = gcd(p, q);
  p /= g;
  q /= g;
  int m = 0;
  long long B[100];
  while (true) {
    B[m++] = p / q;
    if (q == 1) {
      break;
    }
    long long nq = p % q;
    long long np = q;
    long long ng = gcd(nq, np);
    p = np / ng;
    q = nq / ng;
  }
  if (n != m) {
    cout << "NO" << endl;
  } else {
    for (int i = 0; i < n; ++i) {
      if (A[i] != B[i]) {
        cout << "NO" << endl;
        return 0;
      }
    }
    cout << "YES" << endl;
  }
  return 0;
}
