https://4gameforum.ru/showthread.php?t=279021&p=5182499&viewfull=1#post5182499 решение под спойлером.