#include <bits/stdc++.h>
using namespace std;
const int inv = numeric_limits<int>::max();
const int minv = numeric_limits<int>::min();
const int max_n = 100;
int n;
long long a[max_n];
int nsol[2];
long long sol[2][max_n];
void solve(long long p, long long q) {
  sol[0][nsol[0]++] = p / q;
  if (q != 1) solve(q, p % q);
}
long long fgcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return fgcd(b, a % b);
}
bool f(int p) {
  if (n != nsol[p]) return false;
  for (int i = 0; i < n; ++i)
    if (a[i] != sol[p][i]) return false;
  return true;
}
int main() {
  long long p, q;
  long long g;
  cin >> p;
  cin >> q;
  g = fgcd(p, q);
  p /= g;
  q /= g;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  nsol[0] = 0;
  solve(p, q);
  nsol[1] = 0;
  for (int i = 0; i < nsol[0]; ++i) sol[1][nsol[1]++] = sol[0][i];
  --sol[1][nsol[1] - 1];
  sol[1][nsol[1]++] = 1ll;
  if (f(0) or f(1))
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}
