output_description: Print the maximum amount of money that can be earned.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      a_1 a_2 ... a_N
attempt: n = int(input())
  a = list(map(int, input().split()))
  flag = 1
  for i in a:
      if i > 0:
          flag = 0
  if flag:
      print(0)
  else:
      flag_ = 1
      while flag_:
          ans = sum(a)
          prime = [
              2,
              3,
              5,
              7,
              11,
              13,
              17,
              19,
              23,
              29,
              31,
              37,
              41,
              43,
              47,
              53,
              59,
              61,
              67,
              71,
              73,
              79,
              83,
              89,
              97,
          ]
          b = [[] for i in range(100)]
          for i in prime:
              j = i
              while j <= n:
                  b[i].append(a[j - 1])
                  j += i
          c = []
          flag_ = 0
          for i in b:
              if sum(i) < 0:
                  flag_ = 1
              c.append(sum(i))
          dis = 0
          mi = 0
          for i in range(100):
              if c[i] < mi:
                  mi = c[i]
                  dis = i
          if mi >= 0:
              break
          for i in range(1, n + 1):
              if i % dis == 0:
                  a[i - 1] = 0
          ans += -mi
      print(ans)
  
problem_description: Statement
  
  We have N gemstones labeled 1 through N.
  
  You can perform the following operation any number of times (possibly zero).
  
    * Select a positive integer x, and smash all the gems labeled with multiples of x.
  
  Then, for each i, if the gem labeled i remains without getting smashed, you
  will receive a_i yen (the currency of Japan). However, a_i may be negative, in
  which case you will be charged money.
  
  By optimally performing the operation, how much yen can you earn?
samples: [{"input": "6\n    1 2 -6 4 5 3", "output": "12\n    \n\nIt is optimal to smash Gem 3 and 6.\n\n* * *"}, {"input": "6\n    100 -100 -100 -100 100 -100", "output": "200\n    \n\n* * *"}, {"input": "5\n    -1 -2 -3 -4 -5", "output": "0\n    \n\nIt is optimal to smash all the gems.\n\n* * *"}, {"input": "2\n    -1000 100000", "output": "99000"}]