import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;

immutable int mod = 998_244_353;

void main ()
{
	auto tests = readln.strip.to !(int);
	foreach (test; 0..tests)
	{
		auto n = readln.strip.to !(int);
		auto a = readln.splitter.map !(to !(int)).array;
		auto f = new long [n];
		auto c = new long [n];
		long total = 0;
		foreach (k; 0..n)
		{
			int cur = a[k];
			int i;
			for (i = k - 1; i >= 0; i--)
			{
				int parts = (a[i] + cur - 1) / cur;
				cur = a[i] / parts;
				auto key = cast (long) cur << 32 | parts;
				if (key == c[i])
				{
					break;
				}
				f[i] = parts - 1;
				c[i] = key;
			}
			for (i++; i <= k; i++)
			{
				if (i > 0)
				{
					f[i] = (f[i] * (i + 1) +
					    f[i - 1]) % mod;
				}
			}
			total = (total + f[k]) % mod;
		}
		writeln (total);
	}
}
