#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a[100] = {0}, p, q, i, j, k, n, x, y;
  cin >> p >> q;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  x = p;
  y = q;
  if (n == 1) {
    j = 0;
    if (p % q == 0) {
      p = p / q;
    }
    if (p != a[0]) {
      j = -1;
    }
  } else {
    if (n > 1 && a[n - 1] == 1) {
      a[n - 2]++;
      n--;
    }
    i = 0;
    j = 0;
    while (1) {
      if (a[i] != x / y) {
        j = -1;
        break;
      }
      k = x % y;
      x = y;
      y = k;
      i++;
      if (i == n) {
        if (y != 0) {
          j = -1;
        }
        break;
      }
      if (y == 0) {
        j = -1;
        break;
      }
    }
  }
  if (j != -1) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}
