#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)1e5 + 5;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
int main() {
  int n;
  long long q, p;
  long long a[128];
  cin >> p >> q;
  cin >> n;
  long long t = gcd(p, q);
  p /= t, q /= t;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n - 1; ++i) {
    long long t = p / q;
    if (p % q == 0) --t;
    if (t != a[i]) return puts("NO"), 0;
    p -= t * q;
    swap(p, q);
  }
  if (p == a[n - 1] && q == 1)
    puts("YES");
  else
    puts("NO");
  return 0;
}
