#include using namespace std; int main() { int A, B; cin >> A >> B; for (int x = 1; x <= 100000; x++) { if (x % A == x % B) { cout << x << endl; break; } } return 0; }