output_description: Print the maximum possible score of a string.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N M
      l_1 r_1 a_1
      l_2 r_2 a_2
      :
      l_M r_M a_M
attempt: def main():
      N = int(input())
      a = list(map(int, input().split()))
      c1, c2, c3 = 0, 0, 0
      for ai in a:
          if ai == 1:
              c1 += 1
          elif ai == 2:
              c2 += 1
          else:
              c3 += 1
      dp = [[[0] * (N + 1) for i in range(N + 1)] for j in range(c3 + 1)]
  
      for i in range(c3 + 1):
          for j in range(N + 1):
              for k in range(N + 1):
                  try:
                      dp[i][j][k] = (
                          (
                              (i / N) * dp[i - 1][j + 1][k]
                              + (j / N) * dp[i][j - 1][k + 1]
                              + (k / N) * dp[i][j][k - 1]
                              + 1
                          )
                          * N
                          / (i + j + k)
                      )
                  except IndexError:
                      continue
                  except ZeroDivisionError:
                      continue
      print(dp[c3][c2][c1])
  
  
  main()
  
problem_description: Statement
  
  Consider a string of length N consisting of `0` and `1`. The score for the
  string is calculated as follows:
  
    * For each i (1 \leq i \leq M), a_i is added to the score if the string contains `1` at least once between the l_i-th and r_i-th characters (inclusive).
  
  Find the maximum possible score of a string.
samples: [{"input": "5 3\n    1 3 10\n    2 4 -10\n    3 5 10", "output": "20\n    \n\nThe score for `10001` is a_1 + a_3 = 10 + 10 = 20.\n\n* * *"}, {"input": "3 4\n    1 3 100\n    1 1 -10\n    2 2 -20\n    3 3 -30", "output": "90\n    \n\nThe score for `100` is a_1 + a_2 = 100 + (-10) = 90.\n\n* * *"}, {"input": "1 1\n    1 1 -10", "output": "0\n    \n\nThe score for `0` is 0.\n\n* * *"}, {"input": "1 5\n    1 1 1000000000\n    1 1 1000000000\n    1 1 1000000000\n    1 1 1000000000\n    1 1 1000000000", "output": "5000000000\n    \n\nThe answer may not fit into a 32-bit integer type.\n\n* * *"}, {"input": "6 8\n    5 5 3\n    1 1 10\n    1 6 -8\n    3 6 5\n    3 4 9\n    5 5 -2\n    1 3 -6\n    4 6 -7", "output": "10\n    \n\nFor example, the score for `101000` is a_2 + a_3 + a_4 + a_5 + a_7 = 10 + (-8)\n+ 5 + 9 + (-6) = 10."}]