HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Kovrov IT > problem:


2009.E. 50266 - Kovrov

Guest
• Discussion of problem (1)

Volume problems

• 2008.E. 50263 - Points
• 2008.F. 50972 - Division
• 2008.G. 50264 - String Multiplication
• 2008.H. 50254 - Lawyers Council
• 2009.A. 50283 - Tetris 3D
• 2009.B. 50284 - Knights of the Rook
• 2009.C. 50285 - Meat store
• 2009.D. 50259 - Many-coloured roads
• 2009.E. 50266 - Kovrov
• 2009.F. 50267 - Interesting permutat...
• 2009.G. 50260 - What about judges?
• 2009.H. 50268 - Triangles
• 2009.I. 50278 - ATM
• 2010.A. 50287 - Providers
• 2010.B. 50281 - Primes
• 2010.D. 50277 - Unusual Lottery
• 2010.E. 50664 - Polygons

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Автор: Павел Кузнецов, ПГУ.

Kovrov celebrates its anniversary at 1st September, because in 1778 in that day empress Catherine the Great issued the decree about foundation of Kovrov district and the town itself.

In this problem you have to find amount of all positive numbers between 1 and N such that they contain at least one '1' digit, two '7' digits and one '8' digit in decimal notation. I.e. you can get enough digits from the number to write down 1778.

Input
The first line contains a single number N (1 ≤ N ≤ 1000000).
Output
Output a single integer number - the answer for the problem.

Input 1 Output 1
1000
0
Input 2 Output 2
5000
3

Для отправки решений необходимо выполнить вход.

www.contester.ru