#include #include using namespace std; // おまじない bool sosu(int x) { if(x<2){ return false; }else if(x==2){ return true; }else if(x%2==0){ return false; }else{ bool flag=true; for(int i=3; i<=sqrt(x); i+=2){ if(x%i==0){ flag=false; break; } } if(flag) return true; else return false; } } main() { while(true){ int a,d,n,p; cin >> a >> d >> n; if(a==0 && d==0 && n==0) break; int ct=0; for(int i=a; ct