Here is the question:
Let $\left\{q_1, q_2, \ldots\right\}$ be an enumeration of all rational numbers in the interval $[0,1]$. This means that $q_k$'s are rational numbers in $[0,1]$ and that every rational number $q$ in $[0,1]$ is equal to exactly one $q_k$. Now for any $x \in[0,1]$, let $S_x=\left\{k: q_k \leq x\right\}$. Fix a sequence $\left\{p_n\right\}_{n \geq 1}$ of strictly positive real numbers such that $\sum_n p_n=1$. Define a function $h:[0,1] \rightarrow[0,1]$ by $h(x)=\sum_{k \in S_x} p_k$. In other words, $h(x)$ is the sum of $p_k$'s where corresponding $q_k$'s are in $[0, x]$.
(a) Show that $h$ is continuous at all irrational points and is discontinuous at all rational points. In particular, $h$ has infinitely many discontinuity points.
(b) Show that $h$ is Riemann integrable.
(c) Compute $\int_0^1 h$.
I'm done with the first two parts, the first one following from a jump at rationals and second one following from monotonous nature of the function $h$. I need hints for the third part. I'm unable to come up with a proper argument in order to restrict the integral to a value. I would appreciate some help.