</h4><div class="ui bottom attached segment font-content"><div style="position: relative; overflow: hidden;"><div class=content><div>Compute the number of valid ways to paint the remaining barns, modulo 10^9+7,&nbsp;</div>
<div>such that no two barns which are directly connected are the same color.</div>
<div></div>
<p></p></div></div></div></div></div><div class="row"><div class="column"><h4 class="ui top attached block header">样例</h4><div class="ui bottom attached segment font-content"><div style="