#include <bits/stdc++.h>
using namespace std;
vector<unsigned long long> m;
unsigned long long n, k, l, i, j;
unsigned long long p, q, P, Q, w;
void solve(unsigned long long x, unsigned long long y) {
  if (!x || !y) return;
  unsigned long long q = x / y;
  m.push_back(q);
  x -= y * q;
  solve(y, x);
}
int main() {
  cin >> p >> q;
  cin >> n;
  vector<unsigned long long> v(n, 0);
  for (i = 0; i < n; i++) cin >> v[i];
  if (v.size() > 1 && v.back() == 1) v.pop_back(), v.back()++;
  solve(p, q);
  int o = 1;
  if (v.size() != m.size()) o = 0;
  for (i = 0; i < v.size(); i++)
    if (v[i] != m[i]) o = 0;
  if (o)
    cout << "YES";
  else
    cout << "NO";
}
