Without loss of generality we assume that min(a1,a2,…,a2019)=a1. Note that if a,b,c (b=c) are positive, then ∣b−c∣a>min(ba,ca). Hence S=∣a2−a3∣a1+⋯+∣a1−a2∣a2019>0+min(a3a2,a4a2)+⋯+min(a2018a2017,a2019a2017)+a2019a2018+a2a2019=T. Take i0=2 and for each ℓ⩾0 let iℓ+1=iℓ+1 if aiℓ+1>aiℓ+2 and iℓ+1=iℓ+2 otherwise. There is an integral k such that ik<2018 and ik+1⩾2018. Then T⩾ai1a2+ai2ai1+⋯+aik+1aik+a2019a2018+a2a2019=A. We have 1⩽iℓ+1−iℓ⩽2, therefore ik+1∈{2018,2019}. Since 2018⩽ik+1=i0+(i1−i0)+⋯+(ik+1−ik)⩽2(k+2), it follows that k⩾1007. Consider two cases. (i) k=1007. Then in the inequality we have equalities everywhere, in particular ik+1=2018. Applying AM-GM inequality for k+3 numbers to A we obtain A⩾k+3⩾1010. (ii) k⩾1008. If ik+1=2018 then we get A⩾k+3⩾1011 by the same argument as in the case (i). If ik+1=2019 then applying AM-GM inequality to k+2 summands in A (that is, to all the summands except a2019a2018) we get A⩾k+2⩾1010. So we have S>T⩾A⩾1010. For a1=1+ε,a2=ε,a3=1+2ε,a4=2ε,…,a2016=1008ε,a2017=1+1009ε,a2018=ε2,a2019=1 we obtain S=1009+1008ε+1+1009ε−ε21008ε+1−ε21+1009ε. Then limε→0S=1010, which means that the constant 1010 cannot be increased.