#include <bits/stdc++.h>
using namespace std;
long long p, q;
long long n;
vector<long long> o, c;
void sol(long long a, long long b) {
  if (!a || !b) return;
  long long q = a / b;
  c.push_back(q);
  sol(b, a - (q * b));
}
int main() {
  cin >> p >> q >> n;
  o.assign(n, 0);
  for (int i = 0; i < n; i++) cin >> o[i];
  if (n > 1 && o[n - 1] == 1) o[n - 2]++, o.pop_back(), n--;
  sol(p, q);
  if (o.size() != c.size())
    cout << "NO" << endl;
  else {
    bool check = 1;
    for (int i = 0; i < o.size(); i++) check = check && (o[i] == c[i]);
    if (check)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}
