#include <bits/stdc++.h>
using namespace std;
int n;
bool flag = false;
vector<long long> num;
void f(long long p, long long q) {
  if (p == 0 || q == 0) return;
  num.push_back(p / q);
  f(q, p % q);
}
int main() {
  long long p, q;
  scanf("%I64d%I64d", &p, &q);
  f(p, q);
  scanf("%d", &n);
  if (n - num.size() <= 1)
    for (int i = 0; i < n; i++) {
      scanf("%I64d", &p);
      if (i + 1 == n && num.size() + 1 == n) {
        num[i - 1] -= p;
        if (num[i - 1])
          flag = true;
        else
          flag = false;
        continue;
      }
      num[i] -= p;
      if (num[i]) flag = true;
    }
  else
    flag = true;
  (flag) ? printf("NO\n") : printf("YES\n");
  return 0;
}
