Implement a function named calculate_expected_black_stones that computes the expected number of black stones based on a given integer input n. The function should follow the provided implementation logic which involves using modular arithmetic and dynamic programming techniques to derive the results.
Input/Output Requirements:
Input:
An integer n (0 <= n <= 10^6) representing the number of stones to consider.
Output:
A list of integers of size n, each representing the expected number of black stones modulo 998244353.
Implementation Steps:
Initialize necessary constants and variables according to the provided implementation.
Use a loop to compute values using recurrence relations based on specified logic.
Populate the output list with results adjusted for symmetry around the expected values.
Apply necessary modular adjustments to ensure that all results are within the modulo constraint.
Return the final computed list.
File Creation:
The solution must be written in a file named /app/solution.py following the provided function signature. Ensure proper handling of edge cases, particularly when n is zero.
Example:
For input n = 4, the expected output could be [output1, output2, output3, output4] where each output value is calculated according to the specified logic and needs to be determined from the function’s implementation.
Ensure that the code is efficient and adheres to the expected runtime constraints for large values of n.