#include #define rep(i, n) for (int i = 0; i < (n); i++) typedef long long ll; typedef unsigned long long ull; using namespace std; const int INTINF = 1001001001; const long long LLINF = 4e18; const int MOD = 998244353; const int MODINV2 = 499122177; #define all(a) (a).begin(), (a).end() #define rall(a) (a).rbegin(), (a).rend() #define display(a) {for (auto b : (a)) cout << b << " "; cout << endl; } #define Pii pair #define Pli pair #define Pil pair #define Pid pair #define Pdi pair #define Psi pair #define Pic pair #define Pci pair #define Pll pair #define PiPii pair> #define Pls pair #define Tiii tuple #define Tiiii tuple #define Tiiiii tuple #define Tlii tuple #define Till tuple #define Tlll tuple #define Tdii tuple #define Tiid tuple #define Tiil tuple #define Tiic tuple #define Tiiic tuple #define Tliii tuple #define chmax(x, y) x = max(x, y) #define pqueue priority_queue #define pb push_back #define vecint vector #define vecvecint vector> #define vecchar vector #define vecvecchar vector> #define vecll vector #define vecvecll vector> #define PIE acos(-1) #define RAD acos(-1) / 180. #define np next_permutation #define Graph vector> #define mxele max_element #define mnele min_element template void in(Args&... args) { (cin >> ... >> args); } template void in(vector& v){ for(auto& x: v) in(x); } void print() {} template void print(const T& t, const Ts&... ts){ cout << t; ((cout << ' ' << ts), ...); } template void print(const vector& v){ for (size_t i = 0; i < v.size(); i++) { if (i) cout << ' '; cout << v[i]; } } template void out(const Args&... args){ print(args...); cout << '\n'; } #define INT(...) int __VA_ARGS__; in(__VA_ARGS__) #define LL(...) ll __VA_ARGS__; in(__VA_ARGS__) #define STR(...) string __VA_ARGS__; in(__VA_ARGS__) #define VEC(type, name, size) vector name(size); in(name) #define Sort(a) sort(all(a)) #define Rsort(a) sort(rall(a)) template void END(Args&&... args){((cout << args), ...) << '\n'; cout.flush(); exit(0); } template void COUT(Args&&... args) { ((cout << args), ...) << '\n'; } template void COUT_(Args&&... args) { ((cout << args << ' '), ...); } void ENDL(void) { cout << endl; } template void CIN(Args&... args) { (cin >> ... >> args); } #define DUMP(x) dump_impl(#x, (x)) #define UNIQUE(v) { sort(all(v)); v.erase(unique(all(v)), v.end()); } int dy[] = {-1, 0, 1, 0}; // 4 int dx[] = { 0, 1, 0, -1}; // 4 int ddy[] = {-1, -1, -1, 0, 0, 1, 1, 1}; // 8 int ddx[] = {-1, 0, 1, -1, 1, -1, 0, 1}; // 8 // 1. 何がわかれば答えになる?最終的に何を求めれば問題に答えられる? // 2. どういう「状態」で考える?その答えを求めるために、途中で何を覚えておけば良い? // 3. なぜその状態だけで十分?何を捨てられる?何が未来を制約する? // 4. どう更新する?次の要素を見たとき、状態・値をどう変える? int main(int argc, char* argv[]) { INT(N, M); ll ans = 0; for (int a = 1; a <= N; a++) for (int b = 1; b <= M; b++) { ans += lcm(a, b) % MOD; ans %= MOD; } COUT(ans); }