#include <bits/stdc++.h>
void func(long long int a, long long int b, int i, int n, int *check) {
  if (a % b == 0) {
    check[i] = (a / b);
    if (i == n - 1)
      return;
    else {
      check[i] = ((a / b) - 1);
      check[i + 1] = 1;
      return;
    }
  }
  check[i] = (a / b);
  i++;
  long long int temp = b;
  b = a - (a / b) * b;
  a = temp;
  func(a, b, i, n, check);
  return;
}
int main() {
  long long a, b;
  int n;
  int i, j, t, flag = 0;
  scanf("%lld %lld", &a, &b);
  scanf("%d", &n);
  int check[100] = {0}, arr[100] = {0};
  func(a, b, 0, n, check);
  flag = 0;
  for (j = 0; j < n; j++) {
    scanf("%d", &arr[j]);
    if (arr[j] != check[j]) {
      flag = 1;
    }
  }
  if (check[n] != 0) flag = 1;
  if (flag == 1)
    printf("NO\n");
  else
    printf("YES\n");
  return 0;
}
