Need sum of list element on custom print page(html)

Suppose I am on custom page and write this code
{% set tot_qty = [] -%}
{%- for row in doc.items -%}
{% set _ = tot_qty.append(row.qty) %}
{%- endfor-%}

Result : tot_qty= [5,10]

How can we calculate sum on custom print page?