在线等,求助。

输入某年某月某日,判断是该年的第几天。
执行一直错误,说 索引超出了数组界限。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace nianyueri
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("请输入日期:年月日,回车键继续下一个数值的输入");
int y = Console.Read(), m = Console.Read(), d = Console.Read(), i;
int[] month = new int[13] { 0,31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
if (y % 4 == 0 && y % 100 != 0 || y % 400 == 0)
month[2]=29;
for (i = 1; i < m ; i++)
d = d + month[i];
Console.WriteLine("该年的第{0}天", d);
}
}
}