Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... 
Note:
n is positive and will fit within the range of a 32-bit signed integer (n < 231).
Example 1:
Input:
3
Output:
3
Example 2:
Input:
11
Output:
0
Explanation:
The 11th digit of the sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... is a 0, which is part of the number 10.
class Solution:
     def findNthDigit(self, n):
         """
         :type n: int
         :rtype: int
         """
         
    #    my fourth solution.........
         if n <= 0:
             return
         
         i = 0
         nbase = 0
         thres = 1*9
         if n <= thres:
             return n
         
         while 1:
             i += 1
             nbase += 9*10**(i-1)
             thres += (i+1)*9*10**i
             if n <= thres:
                 return int(str((n+i-(thres-(i+1)*9*10**i))//(i+1) + nbase)[(n+i-(thres-(i+1)*9*10**i))%(i+1)])
                            
                            
                            
                            
         """
    #    my third solution....beat 93%....
         if n <= 0:
             return
         
         nbase = 0
         thres = 1*9
         if n <= thres:
             return n
         
         nbase += 9*10**0
         thres += 2*9*10**1
         if n <= thres:
             return int(str((n+1-(thres-2*9*10**1))//2 + nbase)[(n+1-(thres-2*9*10**1))%2])
         
         nbase += 9*10**1
         thres += 3*9*10**2
         if n <= thres:
             return int(str((n+2-(thres-3*9*10**2))//3 + nbase)[(n+2-(thres-3*9*10**2))%3])
         
         nbase += 9*10**2
         thres += 4*9*10**3
         if n <= thres:
             return int(str((n+3-(thres-4*9*10**3))//4 + nbase)[(n+3-(thres-4*9*10**3))%4])
         
         nbase += 9*10**3
         thres += 5*9*10**4
         if n <= thres:
             return int(str((n+4-(thres-5*9*10**4))//5 + nbase)[(n+4-(thres-5*9*10**4))%5])
         
         nbase += 9*10**4
         thres += 6*9*10**5
         if n <= thres:
             return int(str((n+5-(thres-6*9*10**5))//6 + nbase)[(n+5-(thres-6*9*10**5))%6])
         
         nbase += 9*10**5
         thres += 7*9*10**6
         if n <= thres:
             return int(str((n+6-(thres-7*9*10**6))//7 + nbase)[(n+6-(thres-7*9*10**6))%7])
         
         nbase += 9*10**6
         thres += 8*9*10**7
         if n <= thres:
             return int(str((n+7-(thres-8*9*10**7))//8 + nbase)[(n+7-(thres-8*9*10**7))%8])
         
         nbase += 9*10**7
         thres += 9*9*10**8
         if n <= thres:
             return int(str((n+8-(thres-9*9*10**8))//9 + nbase)[(n+8-(thres-9*9*10**8))%9])
         """
                            
                            
         
         
         """
    #    my second solution........beat 96%....
         if n <= 0:
             return
         
         if n <= 1*9:
             return n
         
         if n <= 1*9+2*90:
             return int(str((n+1 - 1*9)//2 + 9)[(n+1 - 1*9)%2])
         
         if n <= 1*9+2*90+3*900:
             return int(str((n+2 - 1*9-2*90)//3 + 99)[(n+2 - 1*9-2*90)%3])
         
         if n <= 1*9+2*90+3*900+4*9000:
             return int(str((n+3 - 1*9-2*90-3*900)//4 + 999)[(n+3 - 1*9-2*90-3*900)%4])
         
         if n <= 1*9+2*90+3*900+4*9000+5*90000:
             return int(str((n+4 - 1*9-2*90-3*900-4*9000)//5 + 9999)[(n+4 - 1*9-2*90-3*900-4*9000)%5])
         
         if n <= 1*9+2*90+3*900+4*9000+5*90000+6*900000:
             return int(str((n+5 - 1*9-2*90-3*900-4*9000-5*90000)//6 + 99999)[(n+5 - 1*9-2*90-3*900-4*9000-5*90000)%6])
         
         if n <= 1*9+2*90+3*900+4*9000+5*90000+6*900000+7*9000000:
             return int(str((n+6 - 1*9-2*90-3*900-4*9000-5*90000-6*900000)//7 + 999999)[(n+6 - 1*9-2*90-3*900-4*9000-5*90000-6*900000)%7])
         
         if n <= 1*9+2*90+3*900+4*9000+5*90000+6*900000+7*9000000+8*90000000:
             return int(str((n+7 - 1*9-2*90-3*900-4*9000-5*90000-6*900000-7*9000000)//8 + 9999999)[(n+7 - 1*9-2*90-3*900-4*9000-5*90000-6*900000-7*9000000)%8])
         
         if n <= 1*9+2*90+3*900+4*9000+5*90000+6*900000+7*9000000+8*90000000+9*900000000:
             return int(str((n+8 - 1*9-2*90-3*900-4*9000-5*90000-6*900000-7*9000000-8*90000000)//9 + 99999999)[(n+8 - 1*9-2*90-3*900-4*9000-5*90000-6*900000-7*9000000-8*90000000)%9])
         """
         
         
 
         
         
         
         """
    #    my first solution...........beat 93%.....
         if n <= 0:
             return
         
         if n <= 1*9:
             return n
         
         if n <= 1*9+2*90:
             return int(str((n+1 - 1*9)//2 + 9)[n%2])
         
         if n <= 1*9+2*90+3*900:
             return int(str((n+2 - 1*9-2*90)//3 + 99)[n%3-1])
         
         if n <= 1*9+2*90+3*900+4*9000:
             return int(str((n+3 - 1*9-2*90-3*900)//4 + 999)[n%4-2])
         
         if n <= 1*9+2*90+3*900+4*9000+5*90000:
             return int(str((n+4 - 1*9-2*90-3*900-4*9000)//5 + 9999)[n%5])
         
         if n <= 1*9+2*90+3*900+4*9000+5*90000+6*900000:
             return int(str((n+5 - 1*9-2*90-3*900-4*9000-5*90000)//6 + 99999)[n%6-4])
         
         if n <= 1*9+2*90+3*900+4*9000+5*90000+6*900000+7*9000000:
             return int(str((n+6 - 1*9-2*90-3*900-4*9000-5*90000-6*900000)//7 + 999999)[n%7])
         
         if n <= 1*9+2*90+3*900+4*9000+5*90000+6*900000+7*9000000+8*90000000:
             return int(str((n+7 - 1*9-2*90-3*900-4*9000-5*90000-6*900000-7*9000000)//8 + 9999999)[n%8-2])
         
         if n <= 1*9+2*90+3*900+4*9000+5*90000+6*900000+7*9000000+8*90000000+9*900000000:
             return int(str((n+8 - 1*9-2*90-3*900-4*9000-5*90000-6*900000-7*9000000-8*90000000)//9 + 99999999)[n%9-1])
         """

class Solution:
     def findNthDigit(self, n):
         """
         :type n: int
         :rtype: int
         """
         
    #    my fourth solution.........
         if n <= 0:
             return
         
         i = 0
         nbase = 0
         thres = 1*9
         if n <= thres:
             return n
         
         while 1:
             i += 1
             nbase += 9*10**(i-1)
             thres += (i+1)*9*10**i
             if n <= thres:
                 return int(str((n+i-(thres-(i+1)*9*10**i))//(i+1) + nbase)[(n+i-(thres-(i+1)*9*10**i))%(i+1)])
                            
                            
                            
                            
         """
    #    my third solution....beat 93%....
         if n <= 0:
             return
         
         nbase = 0
         thres = 1*9
         if n <= thres:
             return n
         
         nbase += 9*10**0
         thres += 2*9*10**1
         if n <= thres:
             return int(str((n+1-(thres-2*9*10**1))//2 + nbase)[(n+1-(thres-2*9*10**1))%2])
         
         nbase += 9*10**1
         thres += 3*9*10**2
         if n <= thres:
             return int(str((n+2-(thres-3*9*10**2))//3 + nbase)[(n+2-(thres-3*9*10**2))%3])
         
         nbase += 9*10**2
         thres += 4*9*10**3
         if n <= thres:
             return int(str((n+3-(thres-4*9*10**3))//4 + nbase)[(n+3-(thres-4*9*10**3))%4])
         
         nbase += 9*10**3
         thres += 5*9*10**4
         if n <= thres:
             return int(str((n+4-(thres-5*9*10**4))//5 + nbase)[(n+4-(thres-5*9*10**4))%5])
         
         nbase += 9*10**4
         thres += 6*9*10**5
         if n <= thres:
             return int(str((n+5-(thres-6*9*10**5))//6 + nbase)[(n+5-(thres-6*9*10**5))%6])
         
         nbase += 9*10**5
         thres += 7*9*10**6
         if n <= thres:
             return int(str((n+6-(thres-7*9*10**6))//7 + nbase)[(n+6-(thres-7*9*10**6))%7])
         
         nbase += 9*10**6
         thres += 8*9*10**7
         if n <= thres:
             return int(str((n+7-(thres-8*9*10**7))//8 + nbase)[(n+7-(thres-8*9*10**7))%8])
         
         nbase += 9*10**7
         thres += 9*9*10**8
         if n <= thres:
             return int(str((n+8-(thres-9*9*10**8))//9 + nbase)[(n+8-(thres-9*9*10**8))%9])
         """
                            
                            
         
         
         """
    #    my second solution........beat 96%....
         if n <= 0:
             return
         
         if n <= 1*9:
             return n
         
         if n <= 1*9+2*90:
             return int(str((n+1 - 1*9)//2 + 9)[(n+1 - 1*9)%2])
         
         if n <= 1*9+2*90+3*900:
             return int(str((n+2 - 1*9-2*90)//3 + 99)[(n+2 - 1*9-2*90)%3])
         
         if n <= 1*9+2*90+3*900+4*9000:
             return int(str((n+3 - 1*9-2*90-3*900)//4 + 999)[(n+3 - 1*9-2*90-3*900)%4])
         
         if n <= 1*9+2*90+3*900+4*9000+5*90000:
             return int(str((n+4 - 1*9-2*90-3*900-4*9000)//5 + 9999)[(n+4 - 1*9-2*90-3*900-4*9000)%5])
         
         if n <= 1*9+2*90+3*900+4*9000+5*90000+6*900000:
             return int(str((n+5 - 1*9-2*90-3*900-4*9000-5*90000)//6 + 99999)[(n+5 - 1*9-2*90-3*900-4*9000-5*90000)%6])
         
         if n <= 1*9+2*90+3*900+4*9000+5*90000+6*900000+7*9000000:
             return int(str((n+6 - 1*9-2*90-3*900-4*9000-5*90000-6*900000)//7 + 999999)[(n+6 - 1*9-2*90-3*900-4*9000-5*90000-6*900000)%7])
         
         if n <= 1*9+2*90+3*900+4*9000+5*90000+6*900000+7*9000000+8*90000000:
             return int(str((n+7 - 1*9-2*90-3*900-4*9000-5*90000-6*900000-7*9000000)//8 + 9999999)[(n+7 - 1*9-2*90-3*900-4*9000-5*90000-6*900000-7*9000000)%8])
         
         if n <= 1*9+2*90+3*900+4*9000+5*90000+6*900000+7*9000000+8*90000000+9*900000000:
             return int(str((n+8 - 1*9-2*90-3*900-4*9000-5*90000-6*900000-7*9000000-8*90000000)//9 + 99999999)[(n+8 - 1*9-2*90-3*900-4*9000-5*90000-6*900000-7*9000000-8*90000000)%9])
         """
         
         
 
         
         
         
         """
    #    my first solution...........beat 93%.....
         if n <= 0:
             return
         
         if n <= 1*9:
             return n
         
         if n <= 1*9+2*90:
             return int(str((n+1 - 1*9)//2 + 9)[n%2])
         
         if n <= 1*9+2*90+3*900:
             return int(str((n+2 - 1*9-2*90)//3 + 99)[n%3-1])
         
         if n <= 1*9+2*90+3*900+4*9000:
             return int(str((n+3 - 1*9-2*90-3*900)//4 + 999)[n%4-2])
         
         if n <= 1*9+2*90+3*900+4*9000+5*90000:
             return int(str((n+4 - 1*9-2*90-3*900-4*9000)//5 + 9999)[n%5])
         
         if n <= 1*9+2*90+3*900+4*9000+5*90000+6*900000:
             return int(str((n+5 - 1*9-2*90-3*900-4*9000-5*90000)//6 + 99999)[n%6-4])
         
         if n <= 1*9+2*90+3*900+4*9000+5*90000+6*900000+7*9000000:
             return int(str((n+6 - 1*9-2*90-3*900-4*9000-5*90000-6*900000)//7 + 999999)[n%7])
         
         if n <= 1*9+2*90+3*900+4*9000+5*90000+6*900000+7*9000000+8*90000000:
             return int(str((n+7 - 1*9-2*90-3*900-4*9000-5*90000-6*900000-7*9000000)//8 + 9999999)[n%8-2])
         
         if n <= 1*9+2*90+3*900+4*9000+5*90000+6*900000+7*9000000+8*90000000+9*900000000:
             return int(str((n+8 - 1*9-2*90-3*900-4*9000-5*90000-6*900000-7*9000000-8*90000000)//9 + 99999999)[n%9-1])
         """
