import math


def calculate_s(px, py):
    """Calculate s array based on x and y arrays"""
    dis = 0.0
    ps = [dis]
    for i in range(len(px) - 1):
        gap = math.sqrt(pow(px[i + 1] - px[i], 2) + pow(py[i + 1] - py[i], 2))
        dis = dis + gap
        ps.append(dis)
    return ps