#include <bits/stdc++.h>
using namespace std;
const double esp = 1e-8;
const int N = 110;
int sign(double x) { return x < -esp ? -1 : (x > esp); }
long long int a[N], A, B;
int n;
int main() {
  cin >> A >> B;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  bool flag = true;
  swap(A, B);
  for (int i = 1; i <= n && flag; i++) {
    swap(A, B);
    int d = sign(1.0 * A / B - a[i]);
    if ((d == -1) || (d == 0 && i != n)) {
      flag = false;
      break;
    }
    A = A - a[i] * B;
  }
  if (!flag || A)
    cout << "NO" << endl;
  else
    cout << "YES" << endl;
  return 0;
}
