問題一覧 > 通常問題

No.3686 Coprime Sum

レベル : / AI推定難易度 : 1700 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 1024 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 38
作問者 : Unbakedbread / テスター : Tamiji153
お気に入りにしたユーザー ProblemId : 13772 / 自分の提出
問題文最終更新日: 2026-08-09 16:06:57
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
μ関数入門コース (順位表) の他の問題:

Problem Statement

You are given positive integers $N$ and $M$.

Over all pairs of a positive integer $a$ not exceeding $N$ and a positive integer $b$ not exceeding $M$ such that $a$ and $b$ are coprime, find the sum of $ab$, modulo $998244353$.

Constraints

  • $N,M$ are integers between $1$ and $10^7$, inclusive

Input

$N\ M$

Output

Output the answer.

Sample

Sample 1
Input
3 5
Output
69

$1\cdot1+1\cdot2+1\cdot3+1\cdot4+1\cdot5+2\cdot1+2\cdot3+2\cdot5+3\cdot1+3\cdot2+3\cdot4+3\cdot5=69$.

Sample 2
Input
31 13
Output
29391
Sample 3
Input
10000000 10000000
Output
283556728

Note that you should output the remainder when divided by $998244353$.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。