#include <bits/stdc++.h>
using namespace std;
const int MaxN = 100;
int n;
long long p, q;
long long a[MaxN + 5], b[MaxN + 5];
int main() {
  while (~scanf("%I64d%I64d", &p, &q)) {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%I64d", &a[i]);
    bool flag = true;
    for (int i = 1; b[i] != 1; i++) {
      if (q == 1 && i < n) {
        if (i < n - 1)
          flag = false;
        else
          b[i] = p - 1, b[i + 1] = 1;
        break;
      }
      b[i] = p / q;
      if (b[i] != a[i]) {
        flag = false;
        break;
      }
      long long t = p;
      p = q;
      q = t % q;
      if (q == 0) break;
    }
    for (int i = 1; i <= n; i++)
      if (a[i] != b[i]) flag = false;
    if (flag)
      printf("YES\n");
    else
      printf("NO\n");
  }
}
