($d,$d,$t)=<>=~/\S+/g;push@{$m{($_+1e9)%$d}},($_+1e9)/$d|0for<>=~/\S+/g;for(values%m){$b=-1e9;$b<$_+$t?($\+=$_+$t-($b<$_-$t?$_-$t:$b+1)+1,$b=$_+$t):0for sort{$a-$b}@$_}print