Problem Statement  
Dave writes the numbers from M to N (inclusive) on a piece of paper in base B (see notes for details). Then he hands the paper to Earl and asks Earl to compute the sum of the numbers. Earl, however, mistakenly assumes the numbers are written in base B+1. Return the value Earl will come up with. For example, if M is 14, N is 18, and B is 3, Dave would write:112 120 121 122 200 Then Earl would sum the values (expressed here in base 10): 22 24 25 26 32 For a result of 129.  
Definition  
 
Notes  
  The number a_{n}a_{n1}...a_{1}a_{0} in base B corresponds to the value a_{n}*B^{n} + a_{n1}*B^{n1} + ... + a_{1}*B + a_{0}. For example 120 in base 3 corresponds to the value 1 * 3^{2} + 2 * 3 + 0 = 15 in decimal, while 120 in base 4 corresponds to the value 1 * 4^{2} + 2 * 4 + 0 = 24 in decimal.  
  When writing numbers in bases higher than 10, it may be necessary to represent digits higher than 9. In such cases letters (a, b, c, ...) are used to represent (10, 11, 12, ...) as needed.  
  The return value is guaranteed to fit within a 64bit signed integer datatype.  
Constraints  
  M and N will be between 1 and 350000000, inclusive.  
  M will be less than or equal to N.  
  B will be between 3 and 16, inclusive.  
Examples  
0)  
 
1)  
 
2)  
 
3)  
