#include <bits/stdc++.h>
int main() {
  long long int p, q;
  scanf("%lld %lld", &p, &q);
  int n;
  scanf("%d", &n);
  int a[n], i;
  for (i = 0; i < n; i++) a[i] = -1;
  for (i = 0; i < n; i++) {
    long long int dick = p / q;
    a[i] = dick;
    p %= q;
    p = p + q - (q = p);
    if (!q) break;
  }
  int l1 = i + 1;
  int b[n];
  for (i = 0; i < n; i++) scanf("%d", &b[i]);
  int flag = 1;
  if (b[n - 1] == 1 && n != 1) {
    b[n - 2] += 1;
    n--;
  }
  int l2 = n;
  if (l1 != l2) flag = 0;
  for (i = 0; (i < n && flag); i++) {
    if (a[i] != b[i]) flag = 0;
  }
  printf(flag ? "YES\n" : "NO\n");
  return 0;
}
