Formula for adding the values of a integer list metafield together

As the title says, I am looking for a formula to add the values of a single metafield together.

We have a product that we sell in blowout, so it contains multiple lengths of the same product (such as 5ft, 3ft, 10ft, 1ft). I am able to list the individual lengths, but at the end of my list, I would like to display the total linear length.

Figured it out

{% assign lengths = product.metafields.custom.lengths.value %}

{% assign sum = 0 %}
{% for length in lengths %}
{% assign sum = sum | plus: length %}
{% endfor %}