Your friend likes riding his bike on the hills outside your town. He asked you to help him count the number of routes he can take. There are several locations on the hills, some of them directly connected by paths (you can take each path only in one given direction). He would like to start at one of the locations given in startPoints and end at location endPoint. Return the number of distinct routes that he can use to do that. If the number is larger than n or infinite, return -1.
The definition of a route is as follows:
You are given all locations and connections between them in the String paths. The j-th character of the i-th element of paths is '1' (one) if there is a direct one-way path from location i to location j, and '0' (zero) otherwise.
|-||paths will contain between 2 and 50 elements, inclusive (let k be this number).|
|-||Each element of paths will contain exactly k characters.|
|-||Each element of paths will contain only '0' (zero) and '1' (one) characters.|
|-||endPoint and each element of startPoints will be between 0 and k-1.|
|-||Each element in startPoints will be distinct.|
|-||None of the elements in startPoints will be equal to endPoint|
|-||n will be between 2 and 10^9, inclusive.|