#include <bits/stdc++.h>
using namespace std;
int main() {
  long long p, q;
  cin >> p >> q;
  long long n;
  cin >> n;
  vector<long long> al(n);
  for (int i = 0; i < n; i++) cin >> al[i];
  if (p == 1 && q == 1) {
    if (n == 1 && al[0] == 1)
      cout << "YES";
    else
      cout << "NO";
    return 0;
  }
  if (al.back() == 1) {
    al.pop_back();
    al[al.size() - 1]++;
  }
  vector<long long> ans;
  long long a = p, b = q, c;
  while (b != 0) {
    if (a % b == 0) {
      ans.push_back(a / b);
      break;
    }
    long long p = a / b;
    ans.push_back(p);
    c = a % b;
    a = b;
    b = c;
  }
  if (al.size() != ans.size()) {
    cout << "NO";
    return 0;
  }
  for (int i = 0; i < ans.size(); i++) {
    if (ans[i] != al[i]) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
  return 0;
}
