Make cumsum recursive to handle very large array