No tags yet

No tag edit access

The problem statement has recently been changed. View the changes.

×
time limit per test: 0.25 sec.

memory limit per test: 65536 KB

memory limit per test: 65536 KB

input: standard

output: standard

output: standard

The number is called lucky if it consists of 2N digits and the sum of the first N digits is equal to the sum of the last N digits. The number is called almost lucky, if it is possible to change one of its digits to some other in such a way, that a new number is lucky. Your task is to find the count of almost lucky numbers in the interval from A to B (including A and B).

The first digit can't be changed to zero because of leading zeroes are not allowed.

The first digit can't be changed to zero because of leading zeroes are not allowed.

The only line of the input file contains two integer numbers A and B (0 <= A <= B <= 10^9).

Output the only number - the requested number of almost lucky numbers.

Input

1 99

Output

81

All two-digits not lucky numbers are almost lucky.

Author: | Andrew V. Lazarev |

Resource: | Saratov SU Contest: Golden Fall 2004 |

Date: | October 2, 2004 |

Codeforces (c) Copyright 2010-2021 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Jun/15/2021 04:49:37 (j1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|