← Home
For problem statement at 0-999/600-699/690-699/690/problemD3.txt this is a correct solution, but verifier at 0-999/600-699/690-699/690/verifierD3.go ends with all tests passed can you fix the verifier? ```go
package main

import (
	"fmt"
)

const MOD = 1000003

type Matrix [][]int64

func multiply(a, b Matrix, size int) Matrix {
	res := make(Matrix, size)
	for i := 0; i < size; i++ {
		res[i] = make([]int64, size)
	}
	for i := 0; i < size; i++ {
		for k := 0; k < size; k++ {
			if a[i][k] == 0 {
				continue
			}
			for j := 0; j < size; j++ {
				res[i][j] += a[i][k] * b[k][j]
			}
		}
		for j := 0; j < size; j++ {
			res[i][j] %= MOD
		}
	}
	return res
}

func power(base Matrix, exp int64, size int) Matrix {
	res := make(Matrix, size)
	for i := 0; i < size; i++ {
		res[i] = make([]int64, size)
		res[i][i] = 1
	}
	for exp > 0 {
		if exp%2 == 1 {
			res = multiply(res, base, size)
		}
		base = multiply(base, base, size)
		exp /= 2
	}
	return res
}

func main() {
	var C int64
	var W, H int
	if _, err := fmt.Scan(&C, &W, &H); err != nil {
		return
	}

	size := W + 1
	A := make(Matrix, size)
	for i := 0; i < size; i++ {
		A[i] = make([]int64, size)
	}

	for j := 0; j < size; j++ {
		A[0][j] = 1
	}
	hMod := int64(H % MOD)
	for j := 0; j < W; j++ {
		A[j+1][j] = hMod
	}

	res := power(A, C+1, size)
	fmt.Println(res[0][0])
}
```