using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;

namespace ReadWriteTemplate
{
    public static class Solver
    {
        private static void SolveCase()
        {
            const long MOD = 998244353;

            int n = ReadInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = ReadInt();
            }

            int max = a.Sum();

            long[] b = new long[max + 1];
            b[0] = 1;
            for (int i = 0; i < n; i++)
            {
                long[] c = new long[max + 1];
                for (int j = 0; j < max - a[i] + 1; j++)
                {
                    c[j] += 2 * b[j];
                    while (c[j] >= MOD)
                    {
                        c[j] -= MOD;
                    }
                    c[j + a[i]] += b[j];
                    if (c[j + a[i]] >= MOD)
                    {
                        c[j + a[i]] -= MOD;
                    }
                }
                b = c;
            }

            long sum = 0;
            for (int i = (max + 1) / 2; i < max + 1; i++)
            {
                sum += b[i];
            }
            sum %= MOD;

            long p = 1;
            for (int i = 0; i < n; i++)
            {
                p = 3 * p % MOD;
            }

            long ans = (p - 3 * sum + 3 * MOD) % MOD;

            if (max % 2 == 0)
            {
                b = new long[max + 1];
                b[0] = 1;
                for (int i = 0; i < n; i++)
                {
                    long[] c = new long[max + 1];
                    for (int j = 0; j < max - a[i] + 1; j++)
                    {
                        c[j] += b[j];
                        if (c[j] >= MOD)
                        {
                            c[j] -= MOD;
                        }
                        c[j + a[i]] += b[j];
                        if (c[j + a[i]] >= MOD)
                        {
                            c[j + a[i]] -= MOD;
                        }
                    }
                    b = c;
                }

                ans = (ans + 3 * b[max / 2]) % MOD;
            }

            Writer.WriteLine(ans);
        }

        public static void Solve()
        {
#if DEBUG
            var sw = Stopwatch.StartNew();
#endif

            SolveCase();

            /*int T = ReadInt();
            for (int i = 0; i < T; i++)
            {
                // Writer.Write("Case #{0}: ", 1 - t);
                SolveCase();
            }*/

#if DEBUG
            sw.Stop();
            Console.WriteLine($"{sw.ElapsedMilliseconds} ms");
#endif
        }

        public static void Main()
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

#if DEBUG
            // Reader = Console.In; Writer = Console.Out;
            Reader = File.OpenText("input.txt"); Writer = File.CreateText("output.txt");
#else
            Reader = Console.In; Writer = Console.Out;
#endif

            // Solve();
            Thread thread = new Thread(Solve, 64 * 1024 * 1024);
            thread.CurrentCulture = CultureInfo.InvariantCulture;
            thread.Start();
            thread.Join();

            Reader.Close();
            Writer.Close();
        }

        public static IOrderedEnumerable<TSource> OrderByWithShuffle<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
        {
            return source.Shuffle().OrderBy(keySelector);
        }

        public static T[] Shuffle<T>(this IEnumerable<T> source)
        {
            T[] result = source.ToArray();
            Shuffle(result);
            return result;
        }

        private static void Shuffle<T>(IList<T> array)
        {
            Random rnd = new Random();
            for (int i = array.Count - 1; i >= 1; i--)
            {
                int k = rnd.Next(i + 1);
                T tmp = array[k];
                array[k] = array[i];
                array[i] = tmp;
            }
        }

        #region Read/Write

        private static TextReader Reader;

        private static TextWriter Writer;

        private static Queue<string> CurrentLineTokens = new Queue<string>();

        private static string[] ReadAndSplitLine()
        {
            return Reader.ReadLine().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
        }

        public static string ReadToken()
        {
            while (CurrentLineTokens.Count == 0)
                CurrentLineTokens = new Queue<string>(ReadAndSplitLine());
            return CurrentLineTokens.Dequeue();
        }

        public static string ReadLine()
        {
            return Reader.ReadLine();
        }

        public static int ReadInt()
        {
            return int.Parse(ReadToken());
        }

        public static long ReadLong()
        {
            return long.Parse(ReadToken());
        }

        public static double ReadDouble()
        {
            return double.Parse(ReadToken(), CultureInfo.InvariantCulture);
        }

        public static int[] ReadIntArray()
        {
            return ReadAndSplitLine().Select(int.Parse).ToArray();
        }

        public static long[] ReadLongArray()
        {
            return ReadAndSplitLine().Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();
        }

        public static int[][] ReadIntMatrix(int numberOfRows)
        {
            int[][] matrix = new int[numberOfRows][];
            for (int i = 0; i < numberOfRows; i++)
                matrix[i] = ReadIntArray();
            return matrix;
        }

        public static string[] ReadLines(int quantity)
        {
            string[] lines = new string[quantity];
            for (int i = 0; i < quantity; i++)
                lines[i] = Reader.ReadLine().Trim();
            return lines;
        }

        public static void WriteArray<T>(IEnumerable<T> array)
        {
            Writer.WriteLine(string.Join(" ", array));
        }

        #endregion
    }
}


Measured memory_bytes: 32792