QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 1024 MB Total points: 100

#3722. 2017

Statistics

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 multiple of $2017$.

Input

The input contains zero or more test cases and is terminated by end-of-file.

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

  • $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$.

Output

For each case, output an integer which denotes the result.

Sample Input

1 2017 1 2016
1 1000000000 1 1000000000

Sample Output

2016
991324197233775

Discussions

About Discussions

The discussion section is only for posting: Editorials, General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues. Submitting multiple issues may cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.