Language: C++

using System;
using System.Collections.Generic;
using System.Text;
using System.Numerics;

namespace SolutionCS
{
    class Program
    {
        class modMCalc
        {
            public const int M = 1000000007;       // 素数(int範囲)

            // 乗算結果 % Mを求める
            static public int Mul(int a, int b)
            {
                return (int)(Math.BigMul(a, b) % M);
            }

            // 冪乗(mod M)
            static public int Pow(int a, int m)
            {
                if (0 == m)
                {
                    return 1;
                }
                if (1 == m)
                {
                    return a;
                }

                int result = 1;
                int param = a;
                for (; m > 0; m >>= 1)
                {
                    if ((m & 0x01) == 1)
                    {
                        result = Mul(result, param);
                    }

                    param = Mul(param, param);
                }

                return result;
            }

            // 除算(mod M)
            static public int Div(int a, int b)
            {
                return Mul(a, Pow(b, M - 2));
            }
        }

        static void Main(string[] args)
        {
            string inS = Console.ReadLine();

            int ans = modMCalc.Pow(3, inS.Length - 1);

            int c = 0;
            for (int i = 1; i < inS.Length; i++)
            {
                if (inS[i] == '1' )
                {
                    c++;
                }
            }

            ans += modMCalc.Mul(modMCalc.Pow(3, c), 2);
            ans %= modMCalc.M;

            Console.WriteLine(ans);
        }
    }
}

Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
    2 | using System.Collections.Generic;
      |       ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
    3 | using System.Text;
      |       ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
    4 | using System.Numerics;
      |       ^~~~~~
a.cc:12:19: error: expected ':' before 'const'
   12 |             public const int M = 1000000007;       // 素数(int範囲)
      |                   ^~~~~~
      |                   :
a.cc:15:20: error: expected unqualified-id before 'public'
   15 |             static public int Mul(int a, int b)
      |                    ^~~~~~
a.cc:21:20: error: expected unqualified-id before 'public'
   21 |             static public int Pow(int a, int m)
      |                    ^~~~~~
a.cc:48:20: error: expected unqualified-id before 'public'
   48 |             static public int Div(int a, int b)
      |                    ^~~~~~
a.cc:52:10: error: expected ';' after class definition
   52 |         }
      |          ^
      |          ;
a.cc:54:26: error: 'string' has not been declared
   54 |         static void Main(string[] args)
      |                          ^~~~~~
a.cc:54:35: error: expected ',' or '...' before 'args'
   54 |         static void Main(string[] args)
      |                                   ^~~~
a.cc:74:6: error: expected ';' after class definition
   74 |     }
      |      ^
      |      ;
a.cc: In static member function 'static void SolutionCS::Program::Main(int*)':
a.cc:56:13: error: 'string' was not declared in this scope
   56 |             string inS = Console.ReadLine();
      |             ^~~~~~
a.cc:58:31: error: expected primary-expression before '.' token
   58 |             int ans = modMCalc.Pow(3, inS.Length - 1);
      |                               ^
a.cc:58:39: error: 'inS' was not declared in this scope; did you mean 'int'?
   58 |             int ans = modMCalc.Pow(3, inS.Length - 1);
      |                                       ^~~
      |                                       int
a.cc:69:28: error: expected primary-expression before '.' token
   69 |             ans += modMCalc.Mul(modMCalc.Pow(3, c), 2);
      |                            ^
a.cc:69:41: error: expected primary-expression before '.' token
   69 |             ans += modMCalc.Mul(modMCalc.Pow(3, c), 2);
      |                                         ^
a.cc:70:28: error: expected primary-expression before '.' token
   70 |             ans %= modMCalc.M;
      |                            ^
a.cc:72:13: error: 'Console' was not declared in this scope
   72 |             Console.WriteLine(ans);
      |             ^~~~~~~