#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100;
int n;
long long int tab[MAXN + 3];
long long int p, q;
int main() {
  cin >> p >> q;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> tab[i];
  if (tab[n - 1] == 1 && n > 1) {
    tab[n - 2]++;
    n--;
  }
  int actual = 0;
  while (q > 0) {
    if (actual >= n) {
      cout << "NO\n";
      return 0;
    }
    long long int k = p / q;
    if (k != tab[actual++]) {
      cout << "NO\n";
      return 0;
    }
    p = p % q;
    swap(p, q);
  }
  if (actual < n) {
    cout << "NO\n";
    return 0;
  }
  cout << "YES\n";
  return 0;
}
