In this task Anna and Maria play the following game. Initially they have a checkered piece of paper with a painted n × m rectangle (only the border, no filling). Anna and Maria move in turns and Anna starts. During each move one should paint inside the last-painted rectangle a new lesser rectangle (along the grid lines). The new rectangle should have no common points with the previous one. Note that when we paint a rectangle, we always paint only the border, the rectangles aren't filled.Nobody wins the game — Anna and Maria simply play until they have done k moves in total. Count the number of different ways to play this game.

The first and only line contains three integers: n, m, k (1 ≤ n, m, k ≤ 1000).

Print the single number — the number of the ways to play the game. As this number can be very big, print the value modulo 1000000007 (109 + 7).

NoteTwo ways to play the game are considered different if the final pictures are different. In other words, if one way contains a rectangle that is not contained in the other way.In the first sample Anna, who performs her first and only move, has only one possible action plan — insert a 1 × 1 square inside the given 3 × 3 square.In the second sample Anna has as much as 9 variants: 4 ways to paint a 1 × 1 square, 2 ways to insert a 1 × 2 rectangle vertically, 2 more ways to insert it horizontally and one more way is to insert a 2 × 2 square.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;

namespace Codeforces
{
    internal class Program
    {
        private const string Test = "E2";

        private static void Solve()
        {
            var MOD = 1000000007;
            var input = ReadIntArray();
            var n = input[0];
            var m = input[1];
            var k = input[2];
            var dp = new List<List<long>>();
            for (int i = 0; i <= 1001; i++)
            {
                dp.Add(new List<long>());
                for (int j = 0; j <= i; j++)
                {
                    if(j == 0 || j == i)
                        dp[i].Add(1);
                    else
                    {
                        dp[i].Add((dp[i-1][j-1] + dp[i - 1][j]) % MOD);
                    }
                }
            }
            var res = Math.Min(n - 1, m - 1) < 2*k ? 0: dp[n - 1][2*k]*dp[m - 1][2*k];
            res %= MOD;
            Console.WriteLine(res);
        }

        private static void Main()
        {
            if (Debugger.IsAttached)
            {
                Console.SetIn(new StreamReader(String.Format(@"..\..\..\..\Tests\{0}.in", Test)));
            }

            Solve();

            if (Debugger.IsAttached)
            {
                Console.In.Close();
                Console.SetIn(new StreamReader(Console.OpenStandardInput()));
                Console.ReadLine();
            }
        }

        #region Reader

        private static string Read()
        {
            return Console.ReadLine();
        }

        private static string[] ReadArray()
        {
            return Console.ReadLine().Split(' ');
        }

        private static int[] ReadIntArray()
        {
            var input = Console.ReadLine().Split(' ').Select(Int32.Parse).ToArray();
            return input;
        }

        private static int ReadInt()
        {
            return Int32.Parse(Console.ReadLine());
        }

        private static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        private static int ReadNextInt(string[] input, int index)
        {
            return Int32.Parse(input[index]);
        }

        #endregion
    }
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;

namespace Codeforces
{
    internal class Program
    {
        private const string Test = "E2";

        private static void Solve()
        {
            var MOD = 1000000007;
            var input = ReadIntArray();
            var n = input[0];
            var m = input[1];
            var k = input[2];
            var dp = new List<List<long>>();
            for (int i = 0; i <= 1001; i++)
            {
                dp.Add(new List<long>());
                for (int j = 0; j <= i; j++)
                {
                    if(j == 0 || j == i)
                        dp[i].Add(1);
                    else
                    {
                        dp[i].Add((dp[i-1][j-1] + dp[i - 1][j]) % MOD);
                    }
                }
            }
            var res = dp[n - 1][Math.Min(2 * k, n-1)] * dp[m - 1][Math.Min(2 * k, m-1)];
            res %= MOD;
            Console.WriteLine(res);
        }

        private static void Main()
        {
            if (Debugger.IsAttached)
            {
                Console.SetIn(new StreamReader(String.Format(@"..\..\..\..\Tests\{0}.in", Test)));
            }

            Solve();

            if (Debugger.IsAttached)
            {
                Console.In.Close();
                Console.SetIn(new StreamReader(Console.OpenStandardInput()));
                Console.ReadLine();
            }
        }

        #region Reader

        private static string Read()
        {
            return Console.ReadLine();
        }

        private static string[] ReadArray()
        {
            return Console.ReadLine().Split(' ');
        }

        private static int[] ReadIntArray()
        {
            var input = Console.ReadLine().Split(' ').Select(Int32.Parse).ToArray();
            return input;
        }

        private static int ReadInt()
        {
            return Int32.Parse(Console.ReadLine());
        }

        private static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        private static int ReadNextInt(string[] input, int index)
        {
            return Int32.Parse(input[index]);
        }

        #endregion
    }
}


Ralph has a magic field which is divided into n × m blocks. That is to say, there are n rows and m columns on the field. Ralph can put an integer in each block. However, the magic field doesn't always work properly. It works only if the product of integers in each row and each column equals to k, where k is either 1 or -1.Now Ralph wants you to figure out the number of ways to put numbers in each block in such a way that the magic field works properly. Two ways are considered different if and only if there exists at least one block where the numbers in the first way and in the second way are different. You are asked to output the answer modulo 1000000007 = 109 + 7.Note that there is no range of the numbers to put in the blocks, but we can prove that the answer is not infinity.

The only line contains three integers n, m and k (1 ≤ n, m ≤ 1018, k is either 1 or -1).

Print a single number denoting the answer modulo 1000000007.

NoteIn the first example the only way is to put -1 into the only block.In the second example the only way is to put 1 into every block.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApp1
{
    class Program
    {
        const int MAXN = 1000000007;
        static long QMul(long a, long b)
        {
            long res = 1;
            long tmp = a;

            while(b != 0)
            {
                if((b & 1L) == 1)
                {
                    res *= tmp;
                    res %= MAXN;
                }
                tmp *= tmp;
                tmp %= MAXN;
                b >>= 1;
            }

            return res;
        }

        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            long[] arr = input.Select(x => Convert.ToInt64(x)).ToArray();

            long n = arr[0];
            long m = arr[1];
            long k = arr[2];

            if(k == -1 && (n+m) % 2 == 1)
            {
                Console.WriteLine("0");
            }
            else
            {
                Console.WriteLine(QMul(QMul(2, (m - 1)), (n - 1)).ToString());
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Codeforces
{

    class Program
    {
        public static readonly int MOD = Convert.ToInt32(1e9 + 7);
        public static readonly int oo = Convert.ToInt32(1e9);
        public static readonly long OO = Convert.ToInt64(1e18);

        static void Main(string[] args)
        {
            String[] data = Console.ReadLine().Split(' ');
            long n = Int64.Parse(data[0]);
            long m = Int64.Parse(data[1]);
            long k = Int64.Parse(data[2]);
            if (k == -1 && (n - m) % 2 != 0)
            {
                Console.Write(0);
                return;
            }

            Console.Write(ModPow(2, (n - 1) % (MOD - 1) * ((m - 1) % (MOD - 1)) % (MOD - 1)));

        }

        static long ModPow(long num, long exponent)
        {
            if (exponent == 0) return 1;
            long m = ModPow(num, exponent / 2);
            return exponent % 2 == 0 ? m * m % MOD : m * m % MOD * num % MOD;
        }

    }

}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Scanner
{
    private readonly char Separator = ' ';
    private int Index = 0;
    private string[] Line = new string[0];
    public string Next()
    {
        if (Index >= Line.Length)
        {
            Line = Console.ReadLine().Split(Separator);
            Index = 0;
        }
        var ret = Line[Index];
        Index++;
        return ret;
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

}
class Program
{
    private readonly int Mod = 1000000007;
    private long N, M;
    private int K;
    public void Solve()
    {
        var sc = new Scanner();
        N = sc.NextLong();
        M = sc.NextLong();
        K = sc.NextInt();
        long yy = (N - 1) % (Mod - 1);
        long xx = (M - 1) % (Mod - 1);
        if (K == 1)
        {
            Console.WriteLine(Pow((xx * yy) % (Mod - 1)));
        }
        else if (K == -1)
        {
            if (N % 2 == M % 2)
            {
                Console.WriteLine(Pow((xx * yy) % (Mod - 1)));
            }
            else
            {
                Console.WriteLine(0);
            }
        }
    }

    private long Pow(long y)
    {
        long res = 1;
        long x = 2;
        while (y > 0)
        {
            if (y % 2 == 1)
            {
                res *= x;
                res %= Mod;
            }
            y /= 2;
            x = (x * x) % Mod;
        }
        return res;
    }

    static void Main(string[] args)
    {
        new Program().Solve();
    }
}

using System;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;

class Program
{
	static void Main()
	{
		long[] nmk = Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray();
		Console.WriteLine(nmk[0] % 2 != nmk[1] % 2 && nmk[2] == -1 ? 0 : BigInteger.ModPow(2, new BigInteger(nmk[0] - 1) * new BigInteger(nmk[1] - 1), 1000000007));
	}
}

using System;
using System.IO;
using System.Text;

namespace Ralph_And_His_Magic_Field
{
    internal class Program
    {
        private const int mod = 1000000007;
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            writer.WriteLine(Solve(args));
            writer.Flush();
        }

        private static long Solve(string[] args)
        {
            long n = Next();
            long m = Next();
            long k = Next();

            if (k==-1 && (n%2)+(m%2)==1)
            {
                return 0;
            }

            if (n == 1 || m == 1)
            {
                return 1;
            }

            long ans = Pow(2, n-1);
            return Pow(ans, m - 1);
        }

        private static long Pow(long a, long k)
        {
            long r = 1;
            while (k > 0)
            {
                if ((k & 1) == 1)
                {
                    r = (r * a) % mod;
                }
                a = (a * a) % mod;
                k >>= 1;
            }
            return r;
        }

        private static long Next()
        {
            int c;
            long m = 1;
            do
            {
                c = reader.Read();
                if (c == '-')
                    m = -1;
            } while (c < '0' || c > '9');
            long res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return m*res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}

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

namespace Codeforces
{
    class Program : ProgramBase
    {
        private const long commonMod = 1000000007;

        static void Main(string[] args)
        {
            var p = new Program();
            var x = p.Solve();
            p.Out(x);
        }
        object Solve()
        {
            var n = ReadLong();
            var m = ReadLong();
            var k = ReadLong();
            if (k == -1 && Math.Abs(n - m) % 2 != 0)
                return 0;
            return fastpow(fastpow(2, n - 1), m - 1);
        }
        long fastpow(long b, long x)
        {
            checked
            {
                if (x == 0)
                    return 1;
                if (x == 1)
                    return b;
                if (x % 2 == 0)
                    return fastpow(b * b % commonMod, x / 2);
                return b * fastpow(b, x - 1) % commonMod;
            }
        }
        int nod(int a, int b)
        {
            if (a < b)
                return nod(b, a);
            if (b == 0)
                return a;
            return nod(b, a % b);
        }

        class End
        {
            public long Val { get; set; }
            public bool Left { get; set; }
        }
    }

    abstract class ProgramBase
    {
        bool? prod = null;
        StreamReader f;
        Queue<string> tokens;
        protected string FileName { private get; set; }

        protected string Read()
        {
            if (f == null)
                f = string.IsNullOrEmpty(FileName)
                    ? new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10)
                    : new StreamReader((GetProd() ? "" : "c:\\dev\\") + FileName);
            return f.ReadLine();
        }

        protected string ReadToken()
        {
            if (tokens == null || tokens.Count == 0)
                tokens = new Queue<string>(Read().Split(' '));
            return tokens.Dequeue();
        }

        protected long ReadLong() { return long.Parse(ReadToken()); }

        protected long[] ReadLongs()
        {
            var s = Read();
            if (s == "")
                return new long[0];
            //var i = s.IndexOf(' ');
            //return new[] { long.Parse(s.Substring(0, i)), long.Parse(s.Substring(i + 1)) };
            var tokens = s.Split(' ');
            var result = new long[tokens.Length];
            for (int i = 0; i < tokens.Length; i++)
                result[i] = long.Parse(tokens[i]);
            return result;
        }

        public void Out(object r)
        {
            if (string.IsNullOrEmpty(FileName))
                Console.WriteLine(r);
            else if (GetProd())
                File.WriteAllText(FileName, r.ToString());
            else
                Console.WriteLine(r);
        }

        private bool GetProd()
        {

            if (!prod.HasValue)
                try
                {
                    prod = Environment.MachineName != "RENADEEN-W7";
                }
                catch (Exception)
                {
                    prod = true;
                }
            return prod.Value;
        }
    }

    public static class Huj
    {
        public static T MinBy<T>(this IEnumerable<T> source, Func<T, double> func) where T : class
        {
            T result = null;
            var min = double.MaxValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (min > current)
                {
                    min = current;
                    result = item;
                }
            }
            return result;
        }

        public static T MaxBy<T>(this IEnumerable<T> source, Func<T, double> func, T defaultValue = default(T))
        {
            T result = defaultValue;
            var max = double.MinValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (max < current)
                {
                    max = current;
                    result = item;
                }
            }
            return result;
        }

        public static string JoinStrings(this IEnumerable<string> s, string d) { return string.Join(d, s.ToArray()); }

        public static string JoinStrings(this IEnumerable<int> s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }
        public static string JoinStrings(this IEnumerable<long> s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }
    }

}

using System;
namespace b
{
    static class Program
    {
        static ulong fastPow(ulong a, ulong exp, uint mod) {
            a %= mod;
            ulong result = 1;
            while (exp > 0) {
                if ((exp & 1) != 0) result = (result * a) % mod;
                a = (a * a) % mod;
                exp >>= 1;
            }
            return result;
        }
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            var n = ulong.Parse(input[0]);
            var m = ulong.Parse(input[1]);
            var prod = long.Parse(input[2]);
            if (n % 2 != m % 2 && prod == -1){
                System.Console.WriteLine(0);
                return;
            }
            System.Console.WriteLine(fastPow(fastPow(2, (m-1), 1000000007), (n-1), 1000000007));
        }
    }
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.IO;
public class CodeForces
{
#if TEST
    // To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.
    const bool testing = true;
#else
const bool testing = false;
#endif

    private static int Next()
    {
        int c;
        int res = 0;
        do
        {
            c = reader.Read();
            if (c == -1)
                return res;
        } while (c < '0' || c > '9');
        res = c - '0';
        while (true)
        {
            c = reader.Read();
            if (c < '0' || c > '9')
                return res;
            res *= 10;
            res += c - '0';
        }
    }
    private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);
    private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);

    static long modular_pow(long bases, long exponent, long modulus)
    {
        if (modulus == 1)
        {
            return 0;
        }
        long result = 1;
        bases = bases % modulus;
        while (exponent > 0)
        {
            if (exponent % 2 == 1)
            {
                result = (result * bases) % modulus;
            }
            exponent = exponent >> 1;
            bases = (bases * bases) % modulus;
        }
        return result;
    }
    static void program(TextReader input)
    {
        //var n = int.Parse(input.ReadLine().TrimEnd());
        var data = input.ReadLine().Split(' ').Select(long.Parse).ToList();
        var n = data[0];
        var m = data[1];
        var k = data[2];
        var mod = 1000000007;

        if(n%2 != m % 2 && k==-1)
        {
            writer.WriteLine(0);
            writer.Flush();
            return;
        }

        writer.WriteLine(modular_pow(modular_pow(2, ((n-1)), mod), (m - 1) , mod));
        writer.Flush();
    }

    public static void Main(string[] args)
    {
        if (!testing)
        { // set testing to false when submiting to codeforces
            program(Console.In); // write your program in 'program' function (its your new main !)
            return;
        }

        Console.WriteLine("Test Case(1) => expected :");
        Console.WriteLine("1\n");
        Console.WriteLine("Test Case(1) => found    :");
        program(new StringReader("1 1 -1\n"));
        Console.WriteLine();
        Console.ReadLine();

        Console.WriteLine("Test Case(2) => expected :");
        Console.WriteLine("1\n");
        Console.WriteLine("Test Case(2) => found    :");
        program(new StringReader("1 3 1\n"));
        Console.WriteLine();
        Console.ReadLine();

        Console.WriteLine("Test Case(3) => expected :");
        Console.WriteLine("16\n");
        Console.WriteLine("Test Case(3) => found    :");
        program(new StringReader("3 3 -1\n"));
        Console.WriteLine();
        Console.ReadLine();

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Numerics;

namespace _900
{
    class Program
    {
        static void Main(string[] args)
        {
            // string qaqstring = Console.ReadLine();
            //
            // int qaqsum = 0;
            // for(int i = 0; i < qaqstring.Length; ++i)
            // {
            //         for(int j = i; j < qaqstring.Length; ++j)
            //         {
            //                 for(int k = j; k < qaqstring.Length; ++k)
            //                 {
            //                     if (qaqstring[i] == 'Q' && qaqstring[j] == 'A' && qaqstring[k] == 'Q')
            //                         qaqsum++;
            //                 }
            //         }
            // }
            // Console.WriteLine(qaqsum);

            string[] input = Console.ReadLine().Split();
            BigInteger m, n, k;
            n = BigInteger.Parse(input[0]);
            m = BigInteger.Parse(input[1]);
            k = BigInteger.Parse(input[2]);

            BigInteger fieldNumber = (n-1) * (m-1);
            BigInteger answer = 0;
            if(((n%2 == 1 && m%2 == 0) || (n%2 == 0 && m%2 == 1)) && k == -1)
                Console.WriteLine(0);
            else if (n == 2 && m == 2)
            {
                Console.WriteLine(2);
            }
            else if(fieldNumber == 1 || n == 1 || m == 1)
                Console.WriteLine(1);
            else
            {
               answer = BigInteger.ModPow(2,fieldNumber, 1000000007);
                Console.WriteLine(answer);
            }

        }

    }
}

using System;
using System.Collections;
using System.Collections.Generic;

// (づ°ω°)づﾐe★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜

namespace dd
{
	class MainClass
	{
		const long MOD = 1000 * 1000 * 1000 + 7;

		public static long BinPow(long a, long b)
		{
			if (b == 0)
				return 1;
			if (b % 2 == 0)
			{
				long Q = BinPow(a, b / 2); Q %= MOD;
				return (Q * Q) % MOD;
			}
			return ((BinPow(a, b - 1) % MOD) * a) % MOD;
		}

		public static void Main(string[] args)
		{
			long n = Reader.NextLong();
			long m = Reader.NextLong();
			long k = Reader.NextLong();
			long ans = 0;
			if (k == -1 && (n % 2 != m % 2))
			{
				Console.WriteLine(ans);
				return;
			}
			else
			{
				ans = BinPow(2, n - 1) % MOD;
				ans = BinPow(ans, m - 1) % MOD;
				Console.WriteLine(ans);
			}
		}

		class Reader
		{
			public static int NextInt()
			{
				int cnt = 0, sign = 1;
				char ch = Convert.ToChar(Console.Read());
				while (!(ch >= '0' && ch <= '9') && ch != '-')
					ch = Convert.ToChar(Console.Read());
				if (ch == '-')
				{
					sign = -1;
					ch = Convert.ToChar(Console.Read());
				}
				while (ch >= '0' && ch <= '9')
				{
					int t = Convert.ToInt32(ch);
					cnt = cnt * 10 + ch - '0';
					ch = Convert.ToChar(Console.Read());
				}
				return cnt * sign;
			}
			public static long NextLong()
			{
				long cnt = 0, sign = 1;
				char ch = Convert.ToChar(Console.Read());
				while (!(ch >= '0' && ch <= '9') && ch != '-')
					ch = Convert.ToChar(Console.Read());
				if (ch == '-')
				{
					sign = -1;
					ch = Convert.ToChar(Console.Read());
				}
				while (ch >= '0' && ch <= '9')
				{
					long t = Convert.ToInt64(ch);
					cnt = cnt * 10 + ch - '0';
					ch = Convert.ToChar(Console.Read());
				}
				return cnt * sign;
			}
		}
	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DTATest
{
    class Program
    {
        static void Main(string[] args)
        {
            String[] line = Console.ReadLine().Split(' ');
			long n;
			long m;
			long k;
			n = long.Parse(line[0]);
			m = long.Parse(line[1]);
			k = long.Parse(line[2]);
			Console.WriteLine(solve(n, m, k));
            Console.Read();

        }

		static long solve(long n, long m, long k)
		{
			long mod = 1000000007;
			if (k == -1 && (m + n) % 2 != 0) {
				return 0;
			} else {
				long a = 2;
				a = qMul(a, n - 1, mod);
				a = qMul(a, m - 1, mod);
				return a;
			}
		}

		static long qMul(long a, long b, long m)
		{
			a %= m;
			long ans = 1;
			while (b != 0) {
				if (b % 2 == 1) {
					ans = (ans * a) % m;
				}
				a = (a * a) % m;
				b >>= 1;
			}
			return ans;
		}
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApp1
{
    class Program
    {
        const int MAXN = 1000000007;
        static long QMul(long a, long b)
        {
            long res = 1;
            long tmp = a;

            while(b != 0)
            {
                if((b & 1L) == 1)
                {
                    res *= tmp;
                    res %= MAXN;
                }
                tmp *= tmp;
                tmp %= MAXN;
                b >>= 1;
            }

            return res;
        }

        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            long[] arr = input.Select(x => Convert.ToInt64(x)).ToArray();

            long n = arr[0];
            long m = arr[1];
            long k = arr[2];

            if(k == -1 && (n+m) % 2 == -1)
            {
                Console.WriteLine("0");
            }
            else
            {
                Console.WriteLine(QMul(QMul(2, (m - 1)), (n - 1)).ToString());
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Codeforces
{

    class Program
    {
        public static readonly int MOD = Convert.ToInt32(1e9 + 7);
        public static readonly int oo = Convert.ToInt32(1e9);
        public static readonly long OO = Convert.ToInt64(1e18);

        static void Main(string[] args)
        {
            String[] data = Console.ReadLine().Split(' ');
            long n = Int64.Parse(data[0]);
            long m = Int64.Parse(data[1]);
            long k = Int64.Parse(data[2]);
            if (k == -1 && (n - m) % 2 != 0)
            {
                Console.Write(0);
                return;
            }

            Console.Write(ModPow(2, (n - 1) % (MOD - 1) * (m - 1) % (MOD - 1)));

        }

        static long ModPow(long num, long exponent)
        {
            if (exponent == 0) return 1;
            long m = ModPow(num, exponent / 2);
            return exponent % 2 == 0 ? m * m % MOD : m * m % MOD * num % MOD;
        }

    }

}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Scanner
{
    private readonly char Separator = ' ';
    private int Index = 0;
    private string[] Line = new string[0];
    public string Next()
    {
        if (Index >= Line.Length)
        {
            Line = Console.ReadLine().Split(Separator);
            Index = 0;
        }
        var ret = Line[Index];
        Index++;
        return ret;
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

}
class Program
{
    private readonly int Mod = 1000000007;
    private long N, M;
    private int K;
    public void Solve()
    {
        var sc = new Scanner();
        N = sc.NextLong();
        M = sc.NextLong();
        K = sc.NextInt();
        long yy = (N - 1) % Mod;
        long xx = (M - 1) % Mod;
        Console.WriteLine(Pow((xx * yy) % Mod));
    }

    private long Pow(long y)
    {
        long res = 1;
        long x = 2;
        while (y > 0)
        {
            if (y % 2 == 1)
            {
                res *= x;
                res %= Mod;
            }
            y /= 2;
            x = (x * x) % Mod;
        }
        return res;
    }

    static void Main(string[] args)
    {
        new Program().Solve();
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Scanner
{
    private readonly char Separator = ' ';
    private int Index = 0;
    private string[] Line = new string[0];
    public string Next()
    {
        if (Index >= Line.Length)
        {
            Line = Console.ReadLine().Split(Separator);
            Index = 0;
        }
        var ret = Line[Index];
        Index++;
        return ret;
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

}
class Program
{
    private readonly int Mod = 1000000007;
    private long N, M;
    private int K;
    public void Solve()
    {
        var sc = new Scanner();
        N = sc.NextLong();
        M = sc.NextLong();
        K = sc.NextInt();
        long yy = (N - 1) % Mod;
        long xx = (M - 1) % Mod;
        if (K == 1)
        {
            Console.WriteLine(Pow((xx * yy) % (Mod - 1)));
        }
        else if (K == -1)
        {
            if (N % 2 == M % 2)
            {
                Console.WriteLine(Pow((xx * yy) % (Mod - 1)));
            }
            else
            {
                Console.WriteLine(0);
            }
        }
    }

    private long Pow(long y)
    {
        long res = 1;
        long x = 2;
        while (y > 0)
        {
            if (y % 2 == 1)
            {
                res *= x;
                res %= Mod;
            }
            y /= 2;
            x = (x * x) % Mod;
        }
        return res;
    }

    static void Main(string[] args)
    {
        new Program().Solve();
    }
}

using System;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;

class Program
{
	static void Main()
	{
		string[] nmk = Console.ReadLine().Split();
		byte[] n = nmk[0].Select(x => (byte) (x - '0')).ToArray(), m = nmk[1].Select(x => (byte) (x - '0')).ToArray();
		Console.WriteLine(BigInteger.ModPow(2, (new BigInteger(n) - 1) * (new BigInteger(m) - 1), 1000000007));
		Console.ReadLine();
	}
}

using System;
using System.Numerics;

class Program
{
    static void Main()
    {

    }
}

using System;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;

class StandartMethods
{
	public static BigInteger Power(BigInteger a, BigInteger n)
	{
		if (n == 0)
			return 1;
		List<BigInteger> pow = new List<BigInteger>() { 1, a };
		BigInteger k = 1;
		while (k < n)
			if (k << 1 <= n)
			{
				a *= a;
				k <<= 1;
				pow.Add(a);
			}
			else
			{
				BigInteger j = k;
				for (int i = pow.Count - 1; i > -1 && k < n; i--, j >>= 1)
					if (k + j <= n)
					{
						a *= pow[i];
						k += j;
					}
			}
		return a;
	}
}

class Program
{
	static void Main()
	{
		int[] nmk = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
		Console.WriteLine(StandartMethods.Power(2, (nmk[0] - 1) * (nmk[1] - 1)) % 1000000007);
		Console.ReadLine();
	}
}

using System;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;

class Program
{
	static void Main()
	{
		long[] nmk = Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray();
		Console.WriteLine(nmk[0] % 2 == nmk[1] % 2 ? BigInteger.ModPow(2, new BigInteger(nmk[0] - 1) * new BigInteger(nmk[1] - 1), 1000000007) : 0);
	}
}

using System;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;

class StandartMethods
{
	public static BigInteger Power(BigInteger a, BigInteger n)
	{
		if (n == 0)
			return 1;
		List<BigInteger> pow = new List<BigInteger>() { 1, a };
		BigInteger k = 1;
		while (k < n)
			if (k << 1 <= n)
			{
				a *= a;
				k <<= 1;
				pow.Add(a);
			}
			else
			{
				BigInteger j = k;
				for (int i = pow.Count - 1; i > -1 && k < n; i--, j >>= 1)
					if (k + j <= n)
					{
						a *= pow[i];
						k += j;
					}
			}
		return a;
	}
}

class Program
{
	static void Main()
	{
		int[] nmk = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
		Console.WriteLine(StandartMethods.Power(2, (nmk[0] - 1) * (nmk[1] - 1)));
	}
}

using System;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;

class StandartMethods
{
	public static BigInteger Power(BigInteger a, BigInteger n)
	{
		if (n == 0)
			return 1;
		List<BigInteger> pow = new List<BigInteger>() { 1, a };
		int k = 1;
		while (k < n)
			if (k << 1 <= n)
			{
				a *= a;
				k <<= 1;
				pow.Add(a);
			}
			else
				for (int i = pow.Count - 1, j = k; i > -1 && k < n; i--, j >>= 1)
					if (k + j <= n)
					{
						a *= pow[i];
						k += j;
					}
		return a;
	}
}

class Program
{
	static void Main()
	{
		int[] nmk = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
		Console.WriteLine(StandartMethods.Power(2, (nmk[0] - 1) * (nmk[1] - 1)));
	}
}

using System;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;

class Program
{
	static void Main()
	{
		long[] nmk = Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray();
		Console.WriteLine(BigInteger.ModPow(2, new BigInteger(nmk[0] - 1) * new BigInteger(nmk[1] - 1), 1000000007));
	}
}

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

namespace Codeforces
{
    class Program : ProgramBase
    {
        private const long commonMod = 1000000007;

        static void Main(string[] args)
        {
            var p = new Program();
            var x = p.Solve();
            p.Out(x);
        }
        object Solve()
        {
            var n = ReadLong();
            var m = ReadLong();
            var k = ReadLong();
            if (k == -1 && Math.Abs(n - m) % 2 != 0)
                return 0;
            return fastpow(2, (((n - 1) % commonMod) * ((m- 1)% commonMod)) % commonMod);
        }

        long fastpow(long b, long x)
        {
            if (x == 0)
                return 1;
            if (x == 1)
                return b;
            if (x % 2 == 0)
                return fastpow(b * b % commonMod, x / 2);
            return b * fastpow(b, x - 1) % commonMod;
        }

        int nod(int a, int b)
        {
            if (a < b)
                return nod(b, a);
            if (b == 0)
                return a;
            return nod(b, a % b);
        }

        class End
        {
            public long Val { get; set; }
            public bool Left { get; set; }
        }
    }

    abstract class ProgramBase
    {
        bool? prod = null;
        StreamReader f;
        Queue<string> tokens;
        protected string FileName { private get; set; }

        protected string Read()
        {
            if (f == null)
                f = string.IsNullOrEmpty(FileName)
                    ? new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10)
                    : new StreamReader((GetProd() ? "" : "c:\\dev\\") + FileName);
            return f.ReadLine();
        }

        protected string ReadToken()
        {
            if (tokens == null || tokens.Count == 0)
                tokens = new Queue<string>(Read().Split(' '));
            return tokens.Dequeue();
        }

        protected long ReadLong() { return long.Parse(ReadToken()); }

        protected long[] ReadLongs()
        {
            var s = Read();
            if (s == "")
                return new long[0];
            //var i = s.IndexOf(' ');
            //return new[] { long.Parse(s.Substring(0, i)), long.Parse(s.Substring(i + 1)) };
            var tokens = s.Split(' ');
            var result = new long[tokens.Length];
            for (int i = 0; i < tokens.Length; i++)
                result[i] = long.Parse(tokens[i]);
            return result;
        }

        public void Out(object r)
        {
            if (string.IsNullOrEmpty(FileName))
                Console.WriteLine(r);
            else if (GetProd())
                File.WriteAllText(FileName, r.ToString());
            else
                Console.WriteLine(r);
        }

        private bool GetProd()
        {

            if (!prod.HasValue)
                try
                {
                    prod = Environment.MachineName != "RENADEEN-W7";
                }
                catch (Exception)
                {
                    prod = true;
                }
            return prod.Value;
        }
    }

    public static class Huj
    {
        public static T MinBy<T>(this IEnumerable<T> source, Func<T, double> func) where T : class
        {
            T result = null;
            var min = double.MaxValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (min > current)
                {
                    min = current;
                    result = item;
                }
            }
            return result;
        }

        public static T MaxBy<T>(this IEnumerable<T> source, Func<T, double> func, T defaultValue = default(T))
        {
            T result = defaultValue;
            var max = double.MinValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (max < current)
                {
                    max = current;
                    result = item;
                }
            }
            return result;
        }

        public static string JoinStrings(this IEnumerable<string> s, string d) { return string.Join(d, s.ToArray()); }

        public static string JoinStrings(this IEnumerable<int> s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }
        public static string JoinStrings(this IEnumerable<long> s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }
    }

}

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

namespace Codeforces
{
    class Program : ProgramBase
    {
        private const long commonMod = 1000000007;

        static void Main(string[] args)
        {
            var p = new Program();
            var x = p.Solve();
            p.Out(x);
        }
        object Solve()
        {
            var n = ReadLong();
            var m = ReadLong();
            var k = ReadLong();
            if (k == -1 && Math.Abs(n - m) % 2 != 0)
                return 0;
            return fastpow(fastpow(2, (n - 1) % commonMod), (m - 1) % commonMod);
        }

        long fastpow(long b, long x)
        {
            checked
            {
                if (x == 0)
                    return 1;
                if (x == 1)
                    return b;
                if (x % 2 == 0)
                    return fastpow((b * b) % commonMod, x / 2);
                return (b * fastpow(b, x - 1)) % commonMod;
            }
        }

        int nod(int a, int b)
        {
            if (a < b)
                return nod(b, a);
            if (b == 0)
                return a;
            return nod(b, a % b);
        }

        class End
        {
            public long Val { get; set; }
            public bool Left { get; set; }
        }
    }

    abstract class ProgramBase
    {
        bool? prod = null;
        StreamReader f;
        Queue<string> tokens;
        protected string FileName { private get; set; }

        protected string Read()
        {
            if (f == null)
                f = string.IsNullOrEmpty(FileName)
                    ? new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10)
                    : new StreamReader((GetProd() ? "" : "c:\\dev\\") + FileName);
            return f.ReadLine();
        }

        protected string ReadToken()
        {
            if (tokens == null || tokens.Count == 0)
                tokens = new Queue<string>(Read().Split(' '));
            return tokens.Dequeue();
        }

        protected long ReadLong() { return long.Parse(ReadToken()); }

        protected long[] ReadLongs()
        {
            var s = Read();
            if (s == "")
                return new long[0];
            //var i = s.IndexOf(' ');
            //return new[] { long.Parse(s.Substring(0, i)), long.Parse(s.Substring(i + 1)) };
            var tokens = s.Split(' ');
            var result = new long[tokens.Length];
            for (int i = 0; i < tokens.Length; i++)
                result[i] = long.Parse(tokens[i]);
            return result;
        }

        public void Out(object r)
        {
            if (string.IsNullOrEmpty(FileName))
                Console.WriteLine(r);
            else if (GetProd())
                File.WriteAllText(FileName, r.ToString());
            else
                Console.WriteLine(r);
        }

        private bool GetProd()
        {

            if (!prod.HasValue)
                try
                {
                    prod = Environment.MachineName != "RENADEEN-W7";
                }
                catch (Exception)
                {
                    prod = true;
                }
            return prod.Value;
        }
    }

    public static class Huj
    {
        public static T MinBy<T>(this IEnumerable<T> source, Func<T, double> func) where T : class
        {
            T result = null;
            var min = double.MaxValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (min > current)
                {
                    min = current;
                    result = item;
                }
            }
            return result;
        }

        public static T MaxBy<T>(this IEnumerable<T> source, Func<T, double> func, T defaultValue = default(T))
        {
            T result = defaultValue;
            var max = double.MinValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (max < current)
                {
                    max = current;
                    result = item;
                }
            }
            return result;
        }

        public static string JoinStrings(this IEnumerable<string> s, string d) { return string.Join(d, s.ToArray()); }

        public static string JoinStrings(this IEnumerable<int> s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }
        public static string JoinStrings(this IEnumerable<long> s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }
    }

}

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

namespace Codeforces
{
    class Program : ProgramBase
    {
        private const long commonMod = 1000000007;

        static void Main(string[] args)
        {
            var p = new Program();
            var x = p.Solve();
            p.Out(x);
        }
        object Solve()
        {
            var n = (ReadLong() - 1) % commonMod;
            var m = (ReadLong() - 1) % commonMod;
            var k = ReadLong();
            return fastpow(2, (n * m) % commonMod);
        }

        long fastpow(long b, long x)
        {
            if (x == 0)
                return 1;
            if (x == 1)
                return b;
            if (x % 2 == 0)
                return fastpow(b * b % commonMod, x / 2);
            return b * fastpow(b, x - 1) % commonMod;
        }

        int nod(int a, int b)
        {
            if (a < b)
                return nod(b, a);
            if (b == 0)
                return a;
            return nod(b, a % b);
        }

        class End
        {
            public long Val { get; set; }
            public bool Left { get; set; }
        }
    }

    abstract class ProgramBase
    {
        bool? prod = null;
        StreamReader f;
        Queue<string> tokens;
        protected string FileName { private get; set; }

        protected string Read()
        {
            if (f == null)
                f = string.IsNullOrEmpty(FileName)
                    ? new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10)
                    : new StreamReader((GetProd() ? "" : "c:\\dev\\") + FileName);
            return f.ReadLine();
        }

        protected string ReadToken()
        {
            if (tokens == null || tokens.Count == 0)
                tokens = new Queue<string>(Read().Split(' '));
            return tokens.Dequeue();
        }

        protected long ReadLong() { return long.Parse(ReadToken()); }

        protected long[] ReadLongs()
        {
            var s = Read();
            if (s == "")
                return new long[0];
            //var i = s.IndexOf(' ');
            //return new[] { long.Parse(s.Substring(0, i)), long.Parse(s.Substring(i + 1)) };
            var tokens = s.Split(' ');
            var result = new long[tokens.Length];
            for (int i = 0; i < tokens.Length; i++)
                result[i] = long.Parse(tokens[i]);
            return result;
        }

        public void Out(object r)
        {
            if (string.IsNullOrEmpty(FileName))
                Console.WriteLine(r);
            else if (GetProd())
                File.WriteAllText(FileName, r.ToString());
            else
                Console.WriteLine(r);
        }

        private bool GetProd()
        {

            if (!prod.HasValue)
                try
                {
                    prod = Environment.MachineName != "RENADEEN-W7";
                }
                catch (Exception)
                {
                    prod = true;
                }
            return prod.Value;
        }
    }

    public static class Huj
    {
        public static T MinBy<T>(this IEnumerable<T> source, Func<T, double> func) where T : class
        {
            T result = null;
            var min = double.MaxValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (min > current)
                {
                    min = current;
                    result = item;
                }
            }
            return result;
        }

        public static T MaxBy<T>(this IEnumerable<T> source, Func<T, double> func, T defaultValue = default(T))
        {
            T result = defaultValue;
            var max = double.MinValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (max < current)
                {
                    max = current;
                    result = item;
                }
            }
            return result;
        }

        public static string JoinStrings(this IEnumerable<string> s, string d) { return string.Join(d, s.ToArray()); }

        public static string JoinStrings(this IEnumerable<int> s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }
        public static string JoinStrings(this IEnumerable<long> s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }
    }

}

using System;
namespace b
{
    static class Program
    {
        static ulong fastPow(ulong a, ulong exp, uint mod) {
            a %= mod;
            ulong result = 1;
            while (exp > 0) {
                if ((exp & 1) != 0) result = (result * a) % mod;
                a = (a * a) % mod;
                exp >>= 1;
            }
            return result;
        }
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            var n = ulong.Parse(input[0]);
            var m = ulong.Parse(input[1]);
            var prod = long.Parse(input[2]);
            if (n % 2 != m % 2 && prod == -1){
                System.Console.WriteLine(0);
                return;
            }
            System.Console.WriteLine(fastPow(2, (n-1)*(m-1), 1000000007));
        }
    }
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.IO;
public class CodeForces
{
#if TEST
    // To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.
    const bool testing = true;
#else
const bool testing = false;
#endif

    private static int Next()
    {
        int c;
        int res = 0;
        do
        {
            c = reader.Read();
            if (c == -1)
                return res;
        } while (c < '0' || c > '9');
        res = c - '0';
        while (true)
        {
            c = reader.Read();
            if (c < '0' || c > '9')
                return res;
            res *= 10;
            res += c - '0';
        }
    }
    private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);
    private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);

    static long modular_pow(long bases, long exponent, long modulus)
    {
        if (modulus == 1)
        {
            return 0;
        }
        long result = 1;
        bases = bases % modulus;
        while (exponent > 0)
        {
            if (exponent % 2 == 1)
            {
                result = (result * bases) % modulus;
            }
            exponent = exponent >> 1;
            bases = (bases * bases) % modulus;
        }
        return result;
    }
    static void program(TextReader input)
    {
        //var n = int.Parse(input.ReadLine().TrimEnd());
        var data = input.ReadLine().Split(' ').Select(long.Parse).ToList();
        var n = data[0];
        var m = data[1];
        var k = data[2];
        var mod = 1000000007;

        if(n%2 != m % 2 && k==-1)
        {
            writer.WriteLine(-1);
            writer.Flush();
            return;
        }

        writer.WriteLine(modular_pow(modular_pow(2, ((n-1)%mod), mod), (m - 1) % mod, mod));
        writer.Flush();
    }

    public static void Main(string[] args)
    {
        if (!testing)
        { // set testing to false when submiting to codeforces
            program(Console.In); // write your program in 'program' function (its your new main !)
            return;
        }

        Console.WriteLine("Test Case(1) => expected :");
        Console.WriteLine("1\n");
        Console.WriteLine("Test Case(1) => found    :");
        program(new StringReader("1 1 -1\n"));
        Console.WriteLine();
        Console.ReadLine();

        Console.WriteLine("Test Case(2) => expected :");
        Console.WriteLine("1\n");
        Console.WriteLine("Test Case(2) => found    :");
        program(new StringReader("1 3 1\n"));
        Console.WriteLine();
        Console.ReadLine();

        Console.WriteLine("Test Case(3) => expected :");
        Console.WriteLine("16\n");
        Console.WriteLine("Test Case(3) => found    :");
        program(new StringReader("3 3 -1\n"));
        Console.WriteLine();
        Console.ReadLine();

    }
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.IO;
public class CodeForces
{
#if TEST
    // To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.
    const bool testing = true;
#else
const bool testing = false;
#endif

    private static int Next()
    {
        int c;
        int res = 0;
        do
        {
            c = reader.Read();
            if (c == -1)
                return res;
        } while (c < '0' || c > '9');
        res = c - '0';
        while (true)
        {
            c = reader.Read();
            if (c < '0' || c > '9')
                return res;
            res *= 10;
            res += c - '0';
        }
    }
    private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);
    private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);

    static long modular_pow(long bases, long exponent, long modulus)
    {
        if (modulus == 1)
        {
            return 0;
        }
        long result = 1;
        bases = bases % modulus;
        while (exponent > 0)
        {
            if (exponent % 2 == 1)
            {
                result = (result * bases) % modulus;
            }
            exponent = exponent >> 1;
            bases = (bases * bases) % modulus;
        }
        return result;
    }
    static void program(TextReader input)
    {
        //var n = int.Parse(input.ReadLine().TrimEnd());
        var data = input.ReadLine().Split(' ').Select(long.Parse).ToList();
        var n = data[0];
        var m = data[1];
        var k = data[2];
        var mod = 1000000007;

        if(n%2 != m % 2 && n!=1 && m!=1)
        {
            writer.WriteLine(-1);
            writer.Flush();
            return;
        }

        writer.WriteLine(modular_pow(2, ((n-1)%mod)* ((m - 1) % mod), mod));
        writer.Flush();
    }

    public static void Main(string[] args)
    {
        if (!testing)
        { // set testing to false when submiting to codeforces
            program(Console.In); // write your program in 'program' function (its your new main !)
            return;
        }

        Console.WriteLine("Test Case(1) => expected :");
        Console.WriteLine("1\n");
        Console.WriteLine("Test Case(1) => found    :");
        program(new StringReader("1 1 -1\n"));
        Console.WriteLine();
        Console.ReadLine();

        Console.WriteLine("Test Case(2) => expected :");
        Console.WriteLine("1\n");
        Console.WriteLine("Test Case(2) => found    :");
        program(new StringReader("1 3 1\n"));
        Console.WriteLine();
        Console.ReadLine();

        Console.WriteLine("Test Case(3) => expected :");
        Console.WriteLine("16\n");
        Console.WriteLine("Test Case(3) => found    :");
        program(new StringReader("3 3 -1\n"));
        Console.WriteLine();
        Console.ReadLine();

    }
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.IO;
public class CodeForces
{
#if TEST
    // To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.
    const bool testing = true;
#else
const bool testing = false;
#endif

    private static int Next()
    {
        int c;
        int res = 0;
        do
        {
            c = reader.Read();
            if (c == -1)
                return res;
        } while (c < '0' || c > '9');
        res = c - '0';
        while (true)
        {
            c = reader.Read();
            if (c < '0' || c > '9')
                return res;
            res *= 10;
            res += c - '0';
        }
    }
    private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);
    private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);

    static long modular_pow(long bases, long exponent, long modulus)
    {
        if (modulus == 1)
        {
            return 0;
        }
        long result = 1;
        bases = bases % modulus;
        while (exponent > 0)
        {
            if (exponent % 2 == 1)
            {
                result = (result * bases) % modulus;
            }
            exponent = exponent >> 1;
            bases = (bases * bases) % modulus;
        }
        return result;
    }
    static void program(TextReader input)
    {
        //var n = int.Parse(input.ReadLine().TrimEnd());
        var data = input.ReadLine().Split(' ').Select(long.Parse).ToList();
        var n = data[0];
        var m = data[1];
        var k = data[2];
        var mod = 1000000007;

        if(n%2 != m % 2)
        {
            writer.WriteLine(-1);
            writer.Flush();
            return;
        }

        writer.WriteLine(modular_pow(2, ((n-1)%mod)* ((m - 1) % mod), mod));
        writer.Flush();
    }

    public static void Main(string[] args)
    {
        if (!testing)
        { // set testing to false when submiting to codeforces
            program(Console.In); // write your program in 'program' function (its your new main !)
            return;
        }

        Console.WriteLine("Test Case(1) => expected :");
        Console.WriteLine("1\n");
        Console.WriteLine("Test Case(1) => found    :");
        program(new StringReader("1 1 -1\n"));
        Console.WriteLine();
        Console.ReadLine();

        Console.WriteLine("Test Case(2) => expected :");
        Console.WriteLine("1\n");
        Console.WriteLine("Test Case(2) => found    :");
        program(new StringReader("1 3 1\n"));
        Console.WriteLine();
        Console.ReadLine();

        Console.WriteLine("Test Case(3) => expected :");
        Console.WriteLine("16\n");
        Console.WriteLine("Test Case(3) => found    :");
        program(new StringReader("3 3 -1\n"));
        Console.WriteLine();
        Console.ReadLine();

    }
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.IO;
public class CodeForces
{
#if TEST
    // To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.
    const bool testing = true;
#else
const bool testing = false;
#endif

    private static int Next()
    {
        int c;
        int res = 0;
        do
        {
            c = reader.Read();
            if (c == -1)
                return res;
        } while (c < '0' || c > '9');
        res = c - '0';
        while (true)
        {
            c = reader.Read();
            if (c < '0' || c > '9')
                return res;
            res *= 10;
            res += c - '0';
        }
    }
    private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);
    private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);

    static long modular_pow(long bases, long exponent, long modulus)
    {
        if (modulus == 1)
        {
            return 0;
        }
        long result = 1;
        bases = bases % modulus;
        while (exponent > 0)
        {
            if (exponent % 2 == 1)
            {
                result = (result * bases) % modulus;
            }
            exponent = exponent >> 1;
            bases = (bases * bases) % modulus;
        }
        return result;
    }
    static void program(TextReader input)
    {
        //var n = int.Parse(input.ReadLine().TrimEnd());
        var data = input.ReadLine().Split(' ').Select(long.Parse).ToList();
        var n = data[0];
        var m = data[1];
        var k = data[2];
        var mod = 1000000007;

        if(n%2 != m % 2 && k==-1)
        {
            writer.WriteLine(0);
            writer.Flush();
            return;
        }

        writer.WriteLine(modular_pow(modular_pow(2, ((n-1)%mod), mod), (m - 1) % mod, mod));
        writer.Flush();
    }

    public static void Main(string[] args)
    {
        if (!testing)
        { // set testing to false when submiting to codeforces
            program(Console.In); // write your program in 'program' function (its your new main !)
            return;
        }

        Console.WriteLine("Test Case(1) => expected :");
        Console.WriteLine("1\n");
        Console.WriteLine("Test Case(1) => found    :");
        program(new StringReader("1 1 -1\n"));
        Console.WriteLine();
        Console.ReadLine();

        Console.WriteLine("Test Case(2) => expected :");
        Console.WriteLine("1\n");
        Console.WriteLine("Test Case(2) => found    :");
        program(new StringReader("1 3 1\n"));
        Console.WriteLine();
        Console.ReadLine();

        Console.WriteLine("Test Case(3) => expected :");
        Console.WriteLine("16\n");
        Console.WriteLine("Test Case(3) => found    :");
        program(new StringReader("3 3 -1\n"));
        Console.WriteLine();
        Console.ReadLine();

    }
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.IO;
public class CodeForces
{
#if TEST
    // To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.
    const bool testing = true;
#else
const bool testing = false;
#endif

    private static int Next()
    {
        int c;
        int res = 0;
        do
        {
            c = reader.Read();
            if (c == -1)
                return res;
        } while (c < '0' || c > '9');
        res = c - '0';
        while (true)
        {
            c = reader.Read();
            if (c < '0' || c > '9')
                return res;
            res *= 10;
            res += c - '0';
        }
    }
    private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);
    private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);

    static long modular_pow(long bases, long exponent, long modulus)
    {
        if (modulus == 1)
        {
            return 0;
        }
        long result = 1;
        bases = bases % modulus;
        while (exponent > 0)
        {
            if (exponent % 2 == 1)
            {
                result = (result * bases) % modulus;
            }
            exponent = exponent >> 1;
            bases = (bases * bases) % modulus;
        }
        return result;
    }
    static void program(TextReader input)
    {
        //var n = int.Parse(input.ReadLine().TrimEnd());
        var data = input.ReadLine().Split(' ').Select(long.Parse).ToList();
        var n = data[0];
        var m = data[1];
        var k = data[2];
        var mod = 1000000007;

        if(n%2 != m % 2 && n!=1 && m!=1)
        {
            writer.WriteLine(-1);
            writer.Flush();
            return;
        }

        writer.WriteLine(modular_pow(modular_pow(2, ((n-1)%mod), mod), (m - 1) % mod, mod));
        writer.Flush();
    }

    public static void Main(string[] args)
    {
        if (!testing)
        { // set testing to false when submiting to codeforces
            program(Console.In); // write your program in 'program' function (its your new main !)
            return;
        }

        Console.WriteLine("Test Case(1) => expected :");
        Console.WriteLine("1\n");
        Console.WriteLine("Test Case(1) => found    :");
        program(new StringReader("1 1 -1\n"));
        Console.WriteLine();
        Console.ReadLine();

        Console.WriteLine("Test Case(2) => expected :");
        Console.WriteLine("1\n");
        Console.WriteLine("Test Case(2) => found    :");
        program(new StringReader("1 3 1\n"));
        Console.WriteLine();
        Console.ReadLine();

        Console.WriteLine("Test Case(3) => expected :");
        Console.WriteLine("16\n");
        Console.WriteLine("Test Case(3) => found    :");
        program(new StringReader("3 3 -1\n"));
        Console.WriteLine();
        Console.ReadLine();

    }
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.IO;
public class CodeForces
{
#if TEST
    // To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.
    const bool testing = true;
#else
const bool testing = false;
#endif

    private static int Next()
    {
        int c;
        int res = 0;
        do
        {
            c = reader.Read();
            if (c == -1)
                return res;
        } while (c < '0' || c > '9');
        res = c - '0';
        while (true)
        {
            c = reader.Read();
            if (c < '0' || c > '9')
                return res;
            res *= 10;
            res += c - '0';
        }
    }
    private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);
    private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);

    static long modular_pow(long bases, long exponent, long modulus)
    {
        if (modulus == 1)
        {
            return 0;
        }
        long result = 1;
        bases = bases % modulus;
        while (exponent > 0)
        {
            if (exponent % 2 == 1)
            {
                result = (result * bases) % modulus;
            }
            exponent = exponent >> 1;
            bases = (bases * bases) % modulus;
        }
        return result;
    }
    static void program(TextReader input)
    {
        //var n = int.Parse(input.ReadLine().TrimEnd());
        var data = input.ReadLine().Split(' ').Select(long.Parse).ToList();
        var n = data[0];
        var m = data[1];
        var k = data[2];
        var mod = 1000000007;

        if(n%2 != m % 2 && k==-1)
        {
            writer.WriteLine(-1);
            writer.Flush();
            return;
        }

        writer.WriteLine(modular_pow(modular_pow(2, ((n-1)), mod), (m - 1) , mod));
        writer.Flush();
    }

    public static void Main(string[] args)
    {
        if (!testing)
        { // set testing to false when submiting to codeforces
            program(Console.In); // write your program in 'program' function (its your new main !)
            return;
        }

        Console.WriteLine("Test Case(1) => expected :");
        Console.WriteLine("1\n");
        Console.WriteLine("Test Case(1) => found    :");
        program(new StringReader("1 1 -1\n"));
        Console.WriteLine();
        Console.ReadLine();

        Console.WriteLine("Test Case(2) => expected :");
        Console.WriteLine("1\n");
        Console.WriteLine("Test Case(2) => found    :");
        program(new StringReader("1 3 1\n"));
        Console.WriteLine();
        Console.ReadLine();

        Console.WriteLine("Test Case(3) => expected :");
        Console.WriteLine("16\n");
        Console.WriteLine("Test Case(3) => found    :");
        program(new StringReader("3 3 -1\n"));
        Console.WriteLine();
        Console.ReadLine();

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _900
{
    class Program
    {
        static void Main(string[] args)
        {
            // string qaqstring = Console.ReadLine();
            //
            // int qaqsum = 0;
            // for(int i = 0; i < qaqstring.Length; ++i)
            // {
            //         for(int j = i; j < qaqstring.Length; ++j)
            //         {
            //                 for(int k = j; k < qaqstring.Length; ++k)
            //                 {
            //                     if (qaqstring[i] == 'Q' && qaqstring[j] == 'A' && qaqstring[k] == 'Q')
            //                         qaqsum++;
            //                 }
            //         }
            // }
            // Console.WriteLine(qaqsum);

            string[] input = Console.ReadLine().Split();
            int m, n, k;
            n = Convert.ToInt32(input[0]);
            m = Convert.ToInt32(input[1]);
            k = Convert.ToInt32(input[2]);

            int fieldNumber = n * m;
            double answer = 0;
            if (fieldNumber == 1 || n == 1 || m == 1)
                answer = 1;
            else if(n%2 == 0 || m%2 ==0)
            {
                answer = ((Math.Pow(2, Convert.ToDouble(n)) + Math.Pow(2, Convert.ToDouble(m)))/2)-2;
            }
            else
                answer = Math.Pow(2, Convert.ToDouble(n)) + Math.Pow(2, Convert.ToDouble(m));

            Console.WriteLine(answer % 1000000007);

        }

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Numerics;

namespace _900
{
    class Program
    {
        static void Main(string[] args)
        {
            // string qaqstring = Console.ReadLine();
            //
            // int qaqsum = 0;
            // for(int i = 0; i < qaqstring.Length; ++i)
            // {
            //         for(int j = i; j < qaqstring.Length; ++j)
            //         {
            //                 for(int k = j; k < qaqstring.Length; ++k)
            //                 {
            //                     if (qaqstring[i] == 'Q' && qaqstring[j] == 'A' && qaqstring[k] == 'Q')
            //                         qaqsum++;
            //                 }
            //         }
            // }
            // Console.WriteLine(qaqsum);

            string[] input = Console.ReadLine().Split();
            BigInteger m, n, k;
            n = BigInteger.Parse(input[0]);
            m = BigInteger.Parse(input[1]);
            k = BigInteger.Parse(input[2]);

            BigInteger fieldNumber = (n-1) * (m-1);
            BigInteger answer = 0;
            if (fieldNumber == 1 || n == 1 || m == 1)
                answer = 1;
            else if(n == 2 && n == 2)
            {
                Console.WriteLine(2);
            }
            else
            {
               answer = BigInteger.ModPow(2,fieldNumber, 1000000007);
            }
            Console.WriteLine(answer);

        }

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Numerics;

namespace _900
{
    class Program
    {
        static void Main(string[] args)
        {
            // string qaqstring = Console.ReadLine();
            //
            // int qaqsum = 0;
            // for(int i = 0; i < qaqstring.Length; ++i)
            // {
            //         for(int j = i; j < qaqstring.Length; ++j)
            //         {
            //                 for(int k = j; k < qaqstring.Length; ++k)
            //                 {
            //                     if (qaqstring[i] == 'Q' && qaqstring[j] == 'A' && qaqstring[k] == 'Q')
            //                         qaqsum++;
            //                 }
            //         }
            // }
            // Console.WriteLine(qaqsum);

            string[] input = Console.ReadLine().Split();
            BigInteger m, n, k;
            n = BigInteger.Parse(input[0]);
            m = BigInteger.Parse(input[1]);
            k = BigInteger.Parse(input[2]);

            BigInteger fieldNumber = (n-1) * (m-1);
            BigInteger answer = 0;
            if (fieldNumber == 1 || n == 1 || m == 1)
                answer = 1;
            else
            {
               answer = BigInteger.ModPow(2,fieldNumber, 1000000007);
            }
            Console.WriteLine(answer);

        }

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Numerics;

namespace _900
{
    class Program
    {
        static void Main(string[] args)
        {
            // string qaqstring = Console.ReadLine();
            //
            // int qaqsum = 0;
            // for(int i = 0; i < qaqstring.Length; ++i)
            // {
            //         for(int j = i; j < qaqstring.Length; ++j)
            //         {
            //                 for(int k = j; k < qaqstring.Length; ++k)
            //                 {
            //                     if (qaqstring[i] == 'Q' && qaqstring[j] == 'A' && qaqstring[k] == 'Q')
            //                         qaqsum++;
            //                 }
            //         }
            // }
            // Console.WriteLine(qaqsum);

            string[] input = Console.ReadLine().Split();
            BigInteger m, n, k;
            n = BigInteger.Parse(input[0]);
            m = BigInteger.Parse(input[1]);
            k = BigInteger.Parse(input[2]);

            BigInteger fieldNumber = (n-1) * (m-1);
            BigInteger answer = 0;
            if (fieldNumber == 1 || n == 1 || m == 1)
                Console.WriteLine(1);
            else if(n == 2 && m == 2)
            {
                Console.WriteLine(2);
            }
            else
            {
               answer = BigInteger.ModPow(2,fieldNumber, 1000000007);
                Console.WriteLine(answer);
            }

        }

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Numerics;

namespace _900
{
    class Program
    {
        static void Main(string[] args)
        {
            // string qaqstring = Console.ReadLine();
            //
            // int qaqsum = 0;
            // for(int i = 0; i < qaqstring.Length; ++i)
            // {
            //         for(int j = i; j < qaqstring.Length; ++j)
            //         {
            //                 for(int k = j; k < qaqstring.Length; ++k)
            //                 {
            //                     if (qaqstring[i] == 'Q' && qaqstring[j] == 'A' && qaqstring[k] == 'Q')
            //                         qaqsum++;
            //                 }
            //         }
            // }
            // Console.WriteLine(qaqsum);

            string[] input = Console.ReadLine().Split();
            BigInteger m, n, k;
            n = BigInteger.Parse(input[0]);
            m = BigInteger.Parse(input[1]);
            k = BigInteger.Parse(input[2]);

            BigInteger fieldNumber = (n-1) * (m-1);
            BigInteger answer = 0;
            if(((n%2 == 1 && m%2 == 0) || (n%2 == 0 && m%2 == 1) && k == -1))
                Console.WriteLine(0);
            else if (n == 2 && m == 2)
            {
                Console.WriteLine(2);
            }
            else if(fieldNumber == 1 || n == 1 || m == 1)
                Console.WriteLine(1);
            else
            {
               answer = BigInteger.ModPow(2,fieldNumber, 1000000007);
                Console.WriteLine(answer);
            }

        }

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Numerics;

namespace _900
{
    class Program
    {
        static void Main(string[] args)
        {
            // string qaqstring = Console.ReadLine();
            //
            // int qaqsum = 0;
            // for(int i = 0; i < qaqstring.Length; ++i)
            // {
            //         for(int j = i; j < qaqstring.Length; ++j)
            //         {
            //                 for(int k = j; k < qaqstring.Length; ++k)
            //                 {
            //                     if (qaqstring[i] == 'Q' && qaqstring[j] == 'A' && qaqstring[k] == 'Q')
            //                         qaqsum++;
            //                 }
            //         }
            // }
            // Console.WriteLine(qaqsum);

            string[] input = Console.ReadLine().Split();
            BigInteger m, n, k;
            n = BigInteger.Parse(input[0]);
            m = BigInteger.Parse(input[1]);
            k = BigInteger.Parse(input[2]);

            BigInteger fieldNumber = (n-1) * (m-1);
            BigInteger answer = 0;
            if (fieldNumber == 1 || n == 1 || m == 1)
                Console.WriteLine(1);
            else if(n == 2 && n == 2)
            {
                Console.WriteLine(2);
            }
            else
            {
               answer = BigInteger.ModPow(2,fieldNumber, 1000000007);
                Console.WriteLine(answer);
            }

        }

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _900
{
    class Program
    {
        static void Main(string[] args)
        {
            // string qaqstring = Console.ReadLine();
            //
            // int qaqsum = 0;
            // for(int i = 0; i < qaqstring.Length; ++i)
            // {
            //         for(int j = i; j < qaqstring.Length; ++j)
            //         {
            //                 for(int k = j; k < qaqstring.Length; ++k)
            //                 {
            //                     if (qaqstring[i] == 'Q' && qaqstring[j] == 'A' && qaqstring[k] == 'Q')
            //                         qaqsum++;
            //                 }
            //         }
            // }
            // Console.WriteLine(qaqsum);

            string[] input = Console.ReadLine().Split();
            int m, n, k;
            n = Convert.ToInt32(input[0]);
            m = Convert.ToInt32(input[1]);
            k = Convert.ToInt32(input[2]);

            int fieldNumber = n * m;
            double answer = 0;
            if (fieldNumber == 1 || n == 1 || m == 1)
                answer = 1;
            else
                answer = Math.Pow(2,Convert.ToDouble(n)) + Math.Pow(2,Convert.ToDouble(m));

            Console.WriteLine(answer);

        }

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Numerics;

namespace _900
{
    class Program
    {
        static void Main(string[] args)
        {
            // string qaqstring = Console.ReadLine();
            //
            // int qaqsum = 0;
            // for(int i = 0; i < qaqstring.Length; ++i)
            // {
            //         for(int j = i; j < qaqstring.Length; ++j)
            //         {
            //                 for(int k = j; k < qaqstring.Length; ++k)
            //                 {
            //                     if (qaqstring[i] == 'Q' && qaqstring[j] == 'A' && qaqstring[k] == 'Q')
            //                         qaqsum++;
            //                 }
            //         }
            // }
            // Console.WriteLine(qaqsum);

            string[] input = Console.ReadLine().Split();
            BigInteger m, n, k;
            n = BigInteger.Parse(input[0]);
            m = BigInteger.Parse(input[1]);
            k = BigInteger.Parse(input[2]);

            BigInteger fieldNumber = (n-1) * (m-1);
            BigInteger answer = 0;
            if (n == 2 && m == 2)
            {
                Console.WriteLine(2);
            }
            else if(fieldNumber == 1 || n == 1 || m == 1)
                Console.WriteLine(1);
            else
            {
               answer = BigInteger.ModPow(2,fieldNumber, 1000000007);
                Console.WriteLine(answer);
            }

        }

    }
}