#include <bits/stdc++.h>   int main() {     int t = 1, i, j, n;     long long int p, q, temp, arr[90];     for (j = 0; j < t; j++) {       scanf( %lld %lld , &p, &q);       scanf( %d , &n);       for (i = 0; i < n; i++) scanf( %lld , &arr[i]);       for (i = 0; i < n; i++) {         if (p / q < arr[i]) {           printf( NO n );           break;         }         p = p - (q * arr[i]);         if (p == 0 && i != n - 1) {           printf( NO n );           break;         }         if (i != n - 1) {           temp = p;           p = q;           q = temp;         }       }       if (p == 0 && i == n)         printf( YES n );       else if (i == n)         printf( NO n );     }     return 0;   }   