Skip to content

Learning path · Programming Foundations with Python

Back to lesson · Conditions

Leap Year

Unrated
English

Language

Contribute a translation
Time limit
1000 ms
Memory limit
256 MB
Submissions
6
Correct
4
Solved by
4
AC rate
66.667%

Statement

A Gregorian year is leap if it is divisible by 400, or divisible by 4 but not by 100. Decide whether the given year is leap.

Input

One integer year, where 1 ≤ year ≤ 9999.

Output

Print 1 for a leap year, otherwise 0.

Examples

Sample input 1
1900
Sample output 1
0
Sample input 2
1999
Sample output 2
0
Sample input 3
2000
Sample output 3
1
Sample input 4
2023
Sample output 4
0