In a village, there are n villagers labeled with 1,2,…,n. Each villager keeps a dog, and the dog is either healthy or sick.
One day (denoted as day 0), a man comes to the village and tells all the villagers an unpleasant truth: there is at least one sick dog in the village.
On day t (t≥1), the each villager i inspects the dog of every villager j such that G_i,j=1. All values G_i,j are given in advance and known to all the villagers. For each dog inspected, the villager learns whether it is healthy or sick.
After all the inspections, if a villager can conclude that his own dog is sick, he shoots it in the afternoon. If more than one villager can reach such conclusion, they all shoot simultaneously. All villagers immediately hear the shots. After that, nobody does anything about dogs until the next day.
The villagers don't exchange information in any way except what is mentioned above.
For each of the (2n−1) possibilities of the health status of dogs, we record two values: the shoot time and how many dogs were shot. Find two sums: the sum of all recorded shoot times and the sum of the amounts of dogs shot. As both may be very large, find them modulo 998,244,353.
The first line contains an integer n (1≤n≤3000).
The i-th of the following n lines contains n binary digits without spaces: G_i,1,G_i,2,…,G_i,n (G_i,j∈0,1, G_i,i=0).
On the first line, print two integers: the sum of all recorded shoot times and the sum of the amounts of dogs shot, both modulo 998,244,353.
For the first sample, there are three possible configurations: