#include <bits/stdc++.h>
class printing {
 public:
  void operator()(int k) { printf("%d", k); }
};
using namespace std;
long long int arr[100000];
int main() {
  long long int p, q, a;
  cin >> p >> q;
  int N, i;
  cin >> N;
  for (i = 0; i < N; ++i) {
    cin >> a;
    if (q == 0 || a > p / q) break;
    p = p - a * q;
    swap(p, q);
  }
  if (i == N && q == 0)
    cout << "YES";
  else
    cout << "NO";
}
