output_description: Print the answer.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
attempt: n = int(input())
  a = 10
  b = 0
  while n // a != 0:
      a = a * 10
      b += 1
  c = (n * 10) // a
  d = n % 10
  print(c, d)
  if b == 0:
      print(n)
  elif b == 1:
      m = 9
      if d == 0:
          c += -1
          d = 10
      if c > d:
          m += (c - 2) * (c - 1) + (2 * d)
          m += 3 * (c - 1)
          print(m)
      else:
          m += c * (c - 1)
          m += 3 * c
          print(m)
  elif b == 2:
      m = 108
      e = (n % 100) // 10
      if c > d:
          m += 5 * ((c - 1) * 10 + e)
          m += 2 * (8 * ((c - 1) * 10 + e)) + 2 * d
          print(m)
      else:
          m += 5 * ((c - 1) * 10 + e + 1)
          m += 2 * (8 * ((c - 1) * 10 + e)) + 2 * (d - 1)
          print(m)
  elif b == 3:
      m = 1998
      e = (n % 100) // 10
      if c > d:
          m += 25 * ((c - 1) * 10 + e)
          m += 22 * (8 * ((c - 1) * 10 + e)) + 22 * d
          print(m)
      else:
          m += 25 * ((c - 1) * 10 + e + 1)
          m += 22 * (8 * ((c - 1) * 10 + e)) + 22 * (d - 1)
          print(m)
  elif b == 4:
      m = 20088
      e = (n % 100) // 10
      if c > d:
          m += 225 * ((c - 1) * 10 + e)
          m += 225 * (8 * ((c - 1) * 10 + e)) + 225 * d
          print(m)
      else:
          m += 225 * ((c - 1) * 10 + e + 1)
          m += 225 * (8 * ((c - 1) * 10 + e)) + 225 * (d - 1)
          print(m)
  elif b == 5:
      m = 202338
      e = (n % 100) // 10
      if c > d:
          m += 2225 * ((c - 1) * 10 + e)
          m += 2222 * (8 * ((c - 1) * 10 + e)) + 2225 * d
          print(m)
      else:
          m += 2225 * ((c - 1) * 10 + e + 1)
          m += 2225 * (8 * ((c - 1) * 10 + e)) + 2225 * (d - 1)
          print(m)
  
problem_description: Statement
  
  Given is a positive integer N.  
  Find the number of pairs (A, B) of positive integers not greater than N that
  satisfy the following condition:
  
    * When A and B are written in base ten without leading zeros, the last digit of A is equal to the first digit of B, and the first digit of A is equal to the last digit of B.
samples: [{"input": "25", "output": "17\n    \n\nThe following 17 pairs satisfy the condition: (1,1), (1,11), (2,2), (2,22),\n(3,3), (4,4), (5,5), (6,6), (7,7), (8,8), (9,9), (11,1), (11,11), (12,21),\n(21,12), (22,2), and (22,22).\n\n* * *"}, {"input": "1", "output": "1\n    \n\n* * *"}, {"input": "100", "output": "108\n    \n\n* * *"}, {"input": "2020", "output": "40812\n    \n\n* * *"}, {"input": "200000", "output": "400000008"}]