Home STD Contest Notification Clarification Problems Ranklist Status Print Sign Out

2018

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 392    Accepted Submission(s): 154


Problem Description
Given $a, b, c, d$, find out the number of pairs of integers $(x, y)$ where $a \leq x \leq b, c \leq y \leq d$ and $x \cdot y$ is a multiple of $2018$.
 

Input
The input consists of several test cases and is terminated by end-of-file.

Each test case contains four integers $a, b, c, d$.
 

Output
For each test case, print an integer which denotes the result.

## Constraint

* $1 \leq a \leq b \leq 10^9, 1 \leq c \leq d \leq 10^9$
* The number of tests cases does not exceed $10^4$.
 

Sample Input
1 2 1 2018 1 2018 1 2018 1 1000000000 1 1000000000
 

Sample Output
3 6051 1485883320325200
 

Statistic | Submit | Clarifications | Back