g(x) = If[0 ≤ x ≤ (2 * pi), abs(sin(x))]
f(x) = If[0 ≤ x ≤ (2 * pi), ((1 - cos(x)) * (0 ≤ x ≤ pi)) + ((3 + cos(x)) * (pi < x ≤ (2 * pi)))]
p = 3.7 (slider from 0 to (2 * pi))
a = Integral(g, 0, p)
R: (p, f(p))