#include #include #include using namespace std; int func(int a, int b, int t) { if (t%a==0 or t%b==0) return t; auto res=(t+b-1)/b*b; auto x=b; unordered_set s; while (true) { if (b>=res or t>a>>b>>t) { int res=func(a, b, t); if (res>t) res=min(res, func(b, a, t)); cout<