In his homework, Sean ran into this problem:
--- How many different shapes of triangles are there in a 2D-plane, with lengths of its sides in
{1,2,…,s} and perimeter no longer than
l ? Two triangles are considered to be in the same shape if they can completely overlap using only translation and rotation. Note that
flips are not allowed. So for
ΔABC and
ΔA′B′C′ (
A,B,C and A′,B′,C′ are listed anti-clockwise.), if
AB=2,BC=3,CA=4 and
A′B′=2,A′C′=4,C′A′=3, they are
not considered to be in the same shape.
Sean likes to consider problems in the binary system, so he uses the binary representation of numbers. He iterated over all possible (a,b,c) trying to find the answer, so what he wanted is the number of triplets (a,b,c) such that:
-
1≤a,b,c≤s and are all integers.
-
a+b>c,a+c>b,b+c>a
-
a+b+c≤l
Then, he chose from these triplets such that each triplet chosen represents a different triangle. However, Sean was so bad at math that when he calculated
a+b+c , he totally forgot about the carries, and therefore got the result of
a⊕b⊕c, which is
the bitwise exclusive OR (XOR) sum of
a,b and
c .
Despite this mistake, Sean wants to know if he makes other mistakes, so he asks you about the answer if the third condition is
a⊕b⊕c≤l rather than
a+b+c≤l. Can you help him out with this?
Since the answer can be enormous, output it modulo
998 244 353 .