13A.md (1027B)
1 Source: https://codeforces.com/problemset/problem/13/A 2 3 A. Numbers 4 5 time limit per test 6 7 1 second 8 9 memory limit per test 10 11 64 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 Little Petya likes numbers a lot. He found that number 123 in base 16 consists of two digits: the first is 7 and the second is 11. So the sum of digits of 123 in base 16 is equal to 18. 22 23 Now he wonders what is an average value of sum of digits of the number *A* written in all bases from 2 to *A* - 1. 24 25 Note that all computations should be done in base 10. You should find the result as an irreducible fraction, written in base 10. 26 27 Input 28 29 Input contains one integer number *A* (3 ≤ *A* ≤ 1000). 30 31 Output 32 33 Output should contain required average value in format «X/Y», where X is the numerator and Y is the denominator. 34 35 Examples 36 37 Input 38 39 ``` 40 5 41 ``` 42 43 Output 44 45 ``` 46 7/3 47 ``` 48 49 Input 50 51 ``` 52 3 53 ``` 54 55 Output 56 57 ``` 58 2/1 59 ``` 60 61 Note 62 63 In the first sample number 5 written in all bases from 2 to 4 looks so: 101, 12, 11. Sums of digits are 2, 3 and 2, respectively.