Let,
$ A=a \times \underbrace {111...1}_{\text{no. of 1's=2017}} \times 10^{4033} $ ; $a$ is the second last digit in decimal representation of $M$
$ B=4 \times \underbrace {111...1}_{\text{no. of 1's=2017}} \times 10^{4033} $
$ X=\underbrace{4444...4}_{\text{(no. of 4's=2016)} } \underbrace{5555...5}_{\text{(no. of 5's=2016)}}6$
$ Y=\underbrace{5555...5}_{\text{(no. of 5's=2016)} } \underbrace{6666...6}_{\text{(no. of 6's=2016)}}7$
$M=(1357900+10p+1)^{(123580+q)}$
Find, the minimum value of $(p+q)$ such that when digits of $[(A+X) \times \underbrace{9999...9}_{\text{no. of 9's=2017}}]$ are reversed we obtain $[(B+Y) \times \underbrace{9999...9}_{\text{no. of 9's=2017}}]$
Note: $p,q$ belong to set of positive integers.
Since we get
$$A=a \times \underbrace {1111...1}_{\text{no. of 1's=2017}} \times 10^{4033}=a\times\frac{10^{2017}-1}{9}\times 10^{4033}$$
$$B=4 \times \underbrace {1111...1}_{\text{no. of 1's=2017}} \times 10^{4033}=4\times \frac{10^{2017}-1}{9}\times 10^{4033}$$
$$X=\underbrace{4444...4}_{\text{(no. of 4's=2016)} } \underbrace{5555...5}_{\text{(no. of 5's=2016)}}6=6+10\times 5\times \frac{10^{2016}-1}{9}+10^{2017}\times 4\times \frac{10^{2016}-1}{9}$$
$$Y=\underbrace{5555...5}_{\text{(no. of 5's=2016)} } \underbrace{6666...6}_{\text{(no. of 6's=2016)}}7=7+10\times 6\times\frac{10^{2016}-1}{9}+10^{2017}\times 5\times\frac{10^{2016}-1}{9}$$
we have $$\begin{align}&(B+Y) \times \underbrace{9999...9}_{\text{no. of 9's=2017}}\\\\&=\underbrace{1111...1}_{\text{no. of 1's=2017}}\times (9B+9Y)\\\\&=\underbrace{1111...1}_{\text{no. of 1's=2017}}\times \left(10^{2016}(4\cdot 10^{4034}+10^{2017}+10)+3\right)\\\\&=\underbrace{1111...1}_{(\text{no. of 1's=2017)}}\times 4\underbrace{0000...0}_{(\text{no. of 0's=2016)}}1\underbrace{0000...0}_{(\text{no. of 0's=2015)}}1\underbrace{0000...0}_{(\text{no. of 0's=2016)}}3\\\\&=\underbrace{4444...4}_{\text{(no. of 4's=2017)}}\underbrace{1111...1}_{\text{(no. of 1's=2016)}}2\underbrace{1111...1}_{\text{(no. of 1's=2016)}}\underbrace{3333...3}_{\text{(no. of 3's=2017)}}\end{align}$$
Now
$$\begin{align}&(A+X) \times \underbrace{9999...9}_{\text{no. of 9's=2017}}\\\\&=\underbrace{1111...1}_{\text{no. of 1's=2017}}\times (9A+9X)\\\\&=\underbrace {111...1}_{\text{no. of 1's=2017}}\times (10^{2016}(a\times 10^{4034}+(4-a)\times 10^{2017}+10)+4)\end{align}$$
Here, for $a=3$, we get $$\begin{align}(A+X) \times \underbrace{9999...9}_{\text{no. of 9's=2017}}&=\underbrace {1111...1}_{(\text{no. of 1's=2017)}}\times 3\underbrace{0000...0}_{\text{(no. of 0's=2016)}}1\underbrace{0000...0}_{\text{(no. of 0's=2017)}}1\underbrace{0000...0}_{\text{(no. of 0's=2016)}}4\\\\&=\underbrace{3333...3}_{(\text{no. of 3's=2017)}}\underbrace{1111...1}_{(\text{no. of 1's=2016)}}2\underbrace{1111...1}_{(\text{no. of 1's=2016)}}\underbrace{4444...4}_{(\text{no. of 4's=2017)}}\end{align}$$ from which we see that $a=3$.
Now $$\begin{align}M&=(1357900+10p+1)^{123580+q}\\\\&\equiv (10p+1)^{123580+q}\pmod{100}\\\\&\equiv (10p+1)^{q}\times ((10p+1)^{20})^{6179}\pmod{100}\\\\&\equiv (10p+1)^q\times \left(1+200p+\sum_{k=2}^{20}\binom{20}{k}(10p)^k\right)^{6179}\pmod{100}\\\\&\equiv (10p+1)^q\pmod{100}\end{align}$$
So, we want to find the minimum value of $p+q$ such that the second last digit in decimal representation of $(10p+1)^q:=S(p,q)$ is $3$.
$p+q=2$ : $S(1,1)=11$
$p+q=3$ : $S(1,2)=121,S(2,1)=21$
$p+q=4$ : $S(1,3)=1331$
Therefore, the answer is $\color{red}{4}$.