#include <bits/stdc++.h>
using namespace std;
int n;
long long t[90];
void gcd(long long a, long long b, int iter) {
  if (b == 0) {
    if (iter != n) {
      cout << "NO";
      exit(0);
    }
  } else {
    if (a / b != t[iter]) {
      cout << "NO";
      exit(0);
    }
    gcd(b, a % b, iter + 1);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  long long p, q;
  cin >> p >> q;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> t[i];
  }
  if (n != 1 && t[n - 1] == 1) {
    t[n - 2]++;
    n--;
  }
  gcd(p, q, 0);
  cout << "YES";
}
