Cookie

来源:互联网 发布:wow60 n服数据库 编辑:程序博客网 时间:2024/06/18 13:27

Description

Fangy collects cookies. Once he decided to take a box and put cookies into it in some way. If we take a square k × k in size, divided into blocks 1 × 1 in size and paint there the main diagonal together with cells, which lie above it, then the painted area will be equal to the area occupied by one cookie k in size. Fangy also has a box with a square base 2n × 2n, divided into blocks 1 × 1 in size. In a box the cookies should not overlap, and they should not be turned over or rotated. See cookies of sizes 2 and 4 respectively on the figure:

To stack the cookies the little walrus uses the following algorithm. He takes out of the repository the largest cookie which can fit in some place in the box and puts it there. Everything could be perfect but alas, in the repository the little walrus has infinitely many cookies of size 2 and larger, and there are no cookies of size 1, therefore, empty cells will remain in the box. Fangy wants to know how many empty cells will be left in the end.

Input

The first line contains a single integer n (0 ≤ n ≤ 1000).

Output

Print the single number, equal to the number of empty cells in the box. The answer should be printed modulo 106 + 3.

Sample Input

Input
3
Output
9

Hint

If the box possesses the base of 23 × 23 (as in the example), then the cookies will be put there in the following manner:


题目大意:输入一个数n,2的n次幂为正方形的边长k,每个小正方形边长为一,以对角线填充正方形不能为单一的小正方形,输出填充完后剩余的白色正方形块数。

题目链接:http://codeforces.com/problemset/problem/70/A

源代码:

#include<cstdio>int main(){    int n,i;    while(~scanf("%d",&n))    {        int sum=1;        for(i=1;i<n;i++)        {            sum=sum*3;        sum=sum%1000003;        }        printf("%d\n",sum);    }    return 0;}

0 0
原创粉丝点击