#D1482. 754

    ID: 1237 Type: Default 2000ms 1073MiB

754

754

There is a string S consisting of digits 1, 2, ..., 9. Lunlun, the Dachshund, will take out three consecutive digits from S, treat them as a single integer X and bring it to her master. (She cannot rearrange the digits.)

The master's favorite number is 753. The closer to this number, the better. What is the minimum possible (absolute) difference between X and 753?

Constraints

  • S is a string of length between 4 and 10 (inclusive).
  • Each character in S is 1, 2, ..., or 9.

Input

Input is given from Standard Input in the following format:

S

Output

Print the minimum possible difference between X and 753.

Examples

Input

1234567876

Output

34

Input

35753

Output

0

Input

1111111111

Output

642

inputFormat

Input

Input is given from Standard Input in the following format:

S

outputFormat

Output

Print the minimum possible difference between X and 753.

Examples

Input

1234567876

Output

34

Input

35753

Output

0

Input

1111111111

Output

642

样例

35753
0