




def    UpperCAmelCase__	(  lowerCamelCase = 1000 ):
  lowercase     :List[Any]   						=    0
  lowercase     :List[str]   						=    (n - 1) // 3
  total += ((terms) * (6 + (terms - 1) * 3)) // 2  # total of an A.P.
  lowercase     :Any   						=    (n - 1) // 5
  total += ((terms) * (10 + (terms - 1) * 5)) // 2
  lowercase     :List[str]   						=    (n - 1) // 15
  total -= ((terms) * (30 + (terms - 1) * 15)) // 2
  return total


if __name__ == "__main__":
     print(f'''{solution() = }''')









def    UpperCAmelCase__	(  lowerCamelCase ):
  lowercase     :Optional[int]   						=    len(lowerCamelCase )
  if n in (0, 1):
    return 0
  return sum(query * (n - i - 1) for i, query in enumerate(sorted(lowerCamelCase ) ) )


if __name__ == "__main__":
     import doctest

     doctest.testmod()



