#include <bits/stdc++.h>
int main() {
  long long int p, q, a[91], b[91], r = 1, temp;
  int j, k = 0, n, flag = 1;
  scanf("%lld %lld", &p, &q);
  scanf("%d", &n);
  for (j = 0; j < n; j++) scanf("%lld", &a[j]);
  if (p == 1 && q == 1) {
    b[0] = 1;
    if (n == 1 && a[0] == 1)
      printf("YES\n");
    else
      printf("NO\n");
  } else {
    if (a[n - 1] == 1) {
      a[n - 2] += 1;
      n--;
    }
    while (p > 0 && q > 0) {
      b[k] = p / q;
      temp = p;
      p = q;
      q = temp - (b[k] * q);
      k++;
    }
    if (k == n) {
      {
        for (j = 0; j < k; j++) {
          if (b[j] != a[j]) {
            flag = 0;
            break;
          }
        }
      }
    } else {
      flag = 0;
    }
    if (flag == 1)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
