#include using namespace std; ifstream f1("cheating.in"); ofstream f2("cheating.out"); int n, k, l, i=1, br; set m; int main(){ f1 >> n >> k >> l; while(m.find(i)==m.end()){ if(i==l){f2 << br << endl; return 0;} m.insert(i); i+=k; if(i>n)i%=n; br++; } f2 << "Impossible" << endl; return 0; }