program main
  implicit none
  integer, parameter :: A = 1, C = 2, G = 3, T = 4
  integer(8) :: dp(4, 4, 4, 0:100)  ! dp(i, j, k, l) は l 文字目までの3文字が (i, j, k) である場合の数
  integer :: itr, i, j, k, l, n
  integer(8), parameter :: m = 10 ** 9 + 7

  read (*, *) n

  dp(:, :, :, :) = 0
  dp(T, T, T, 0) = 1
  do itr = 1, n
    do i = 1, 4
      do j = 1, 4
        do k = 1, 4
          do l = 1, 4
            if (is_ok(i, j, k, l)) then
              dp(j, k, l, itr) = dp(j, k, l, itr) + dp(i, j, k, itr - 1)
              dp(j, k, l, itr) = modulo(dp(j, k, l, itr), m)
            end if
          end do
        end do
      end do
    end do
  end do

  write (*, "(i0)") modulo(sum(dp(:, :, :, n)), m)

  contains

  pure function is_ok(i, j, k, l)
    integer, intent(in) :: i, j, k, l
    logical :: is_ok
    is_ok = .true.
    if (all([j, k, l] == [A, G, C])) is_ok = .false.
    if (all([j, k, l] == [G, A, C])) is_ok = .false.
    if (all([j, k, l] == [A, C, G])) is_ok = .false.
    if (all([i, k, l] == [A, G, C])) is_ok = .false.
    if (all([i, j, l] == [A, G, C])) is_ok = .false.
  end function is_ok
end program main
