Parameterize the line segments (call them [tex]C_1[/tex] and [tex]C_2[/tex], respectively, by
[tex]\vec r_1(t)=(1-t)(0,0)+t(4,1)=(4t,t)[/tex]
[tex]\vec r_2(t)=(1-t)(4,1)+t(5,0)=(4+t,1-t)[/tex]
both with [tex]0\le t\le1[/tex]. Then
[tex]\displaystyle\int_C(x+4y)\,\mathrm dx+x^2\,\mathrm dy[/tex]
[tex]=\displaystyle\int_0^1\bigg((4t+4t)(4)+(4t)^2(1)\bigg)\,\mathrm dt+\int_0^1\bigg((4+t+4(1-t))(1)+(4+t)^2(-1)\bigg)\,\mathrm dt[/tex]
[tex]=\displaystyle\int_0^115t^2+21t-8\,\mathrm dt=\boxed{\frac{15}2}[/tex]