PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000112. Đếm cặp theo ƯCLN và BCNN (Nastya Studies Informatics)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Đếm cặp theo ƯCLN và BCNN (Nastya Studies Informatics)
Nastya Studies Informatics
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
Given , count the ordered pairs satisfying , and . The pairs and are different if .
Input
One line containing .
Output
Print the number of valid ordered pairs.
Subtasks
- Subtask 1 (20 points): , .
- Subtask 2 (30 points): , .
- Subtask 3 (50 points): , .
Examples
Input
1 12 1 12
Output
4
Explanation
The four pairs are , all with GCD and LCM .