A degree formula for secant varieties of curves