import java.util.*; public class Main { static long gcd(long a,long b){ return b == 0 ? a : gcd(b, a%b); } static long lcm(long a, long b){ return a*b/gcd(a, b); } public static void main(String[] args) { Scanner sc = new Scanner(System.in); long p = sc.nextLong(); long q = sc.nextLong(); int n = sc.nextInt(); int[] x = new int[n]; int[] y = new int[n]; for(int i=0;i