The modulus of p-variation and its applications