Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/boolean-baxtli-chipta

Lucky ticket

Medium 1000 ms 64 MB 39%
Share

The number of a bus ticket is a six-digit positive integer $n$. A ticket is called “lucky” if the sum of its first three digits equals the sum of its last three digits: for example, $123321$ is lucky because $1 + 2 + 3 = 3 + 2 + 1$. Check whether the statement is true: “the ticket is lucky”.

The sums of the first and the last three digits of a six-digit number

Input

One six-digit positive integer $n$.

Output

One integer: $1$ if the statement is true, otherwise $0$.

Note

$100000 \le n \le 999999$

Examples

Input #1
123321
Output #1
1
Input #2
123456
Output #2
0

Sign in to submit a solution

Signing up is free and takes a minute.