
#include <iostream>
#include "snaps.h"
#include "mkisosu.h"
#include "mecon.h"
#include "mcntl.h"
#include "mfile_open.h"
#include "option.h"

void Atamawari()
{
	int nendo;
	int nenrei;
	int seido;
	int shinkyu;
	int kubun;
	int taishou;
	int tokubetu_shurui;
	int sotai_nendo;
	int seibetu;
	int shikyu_keitai;
	int kikan;
	int noufu_joutai;
	
	int SHIHARAIOKURE = 2;

	for( nendo = SHONENDO ; nendo <= SAISHUNENDO ; nendo++ )
	{

		sotai_nendo = nendo - SHONENDO;

		for( seido = SUM ; seido <= SHIGAKU ; seido++ )
		{
			for( shinkyu = SUM ; shinkyu <= OLD ; shinkyu++ )
			{
				for( kubun = SUM ; kubun <= IZOKU ; kubun++ )
				{
					for( taishou = SUM ; taishou <= TOKUBETU ; taishou++ )
					{
						for( shikyu_keitai = SUM ; shikyu_keitai <= KAKYU ; shikyu_keitai++ )
						{
							for( nenrei = NENREI_SUM ; nenrei <= MAX_JUKYU ; nenrei++ )
							{
								for( kikan = SUM ; kikan <= KOUHAN ; kikan++ )
								{
									Kyufu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan] = 0.;
									Kyufu_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan] = 0.;
									Kyufu_Nendomatu_P[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan] = 0.;

									if( taishou == KYOSHUTU )
									{
										Kokko[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan] = 0.;
										Kokko_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan] = 0.;
										Kokko_Nendomatu_P[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan] = 0.;
									}
								}
							}
						}
					}
				}
			}
		}


		for( seido = SUM ; seido <= NORIN ; seido++ )
		{
			for( nenrei = NENREI_SUM ; nenrei <= MAX_JUKYU ; nenrei++ )
			{
				for( kikan = SUM ; kikan <= KOUHAN ; kikan++ )
				{
					Kyoshutukin[seido][sotai_nendo][nenrei - NENREI_SUM][kikan] = 0.;
					Kyoshutukin_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][kikan] = 0.;
					Kyoshutukin_Nendomatu_P[seido][sotai_nendo][nenrei - NENREI_SUM][kikan] = 0.;

					Kyoshutukin_Kokko[seido][sotai_nendo][nenrei - NENREI_SUM][kikan] = 0.;
					Kyoshutukin_Kokko_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][kikan] = 0.;
					Kyoshutukin_Kokko_Nendomatu_P[seido][sotai_nendo][nenrei - NENREI_SUM][kikan] = 0.;
				}
			}
		}
		for( nenrei = NENREI_SUM ; nenrei <= MAX_JUKYU ; nenrei++ )
		{
			for( kikan = SUM ; kikan <= KOUHAN ; kikan++ )
			{
				Tanka[sotai_nendo][nenrei - NENREI_SUM][kikan] = 0.;
				Tanka_Nendomatu[sotai_nendo][nenrei - NENREI_SUM][kikan] = 0.;
				Tanka_Nendomatu_P[sotai_nendo][nenrei - NENREI_SUM][kikan] = 0.;

				Tanka_Kokko[sotai_nendo][nenrei - NENREI_SUM][kikan] = 0.;
				Tanka_Kokko_Nendomatu[sotai_nendo][nenrei - NENREI_SUM][kikan] = 0.;
				Tanka_Kokko_Nendomatu_P[sotai_nendo][nenrei - NENREI_SUM][kikan] = 0.;
			}
		}
		
		for( tokubetu_shurui = SUM ; tokubetu_shurui <= TOKUBETU_20MAE ; tokubetu_shurui++ )
		{
			for( shikyu_keitai = SUM ; shikyu_keitai <= KAKYU ; shikyu_keitai++ )
			{
				for( nenrei = NENREI_SUM ; nenrei <= MAX_JUKYU ; nenrei++ )
				{
					for( kikan = SUM ; kikan <= KOUHAN ; kikan++ )
					{
						Tokubetukokko[sotai_nendo][nenrei - NENREI_SUM][tokubetu_shurui][shikyu_keitai][kikan] = 0.;
						Tokubetukokko_Nendomatu[sotai_nendo][nenrei - NENREI_SUM][tokubetu_shurui][shikyu_keitai][kikan] = 0.;
						Tokubetukokko_Nendomatu_P[sotai_nendo][nenrei - NENREI_SUM][tokubetu_shurui][shikyu_keitai][kikan] = 0.;
					}
				}
			}
		}
	}
	
	for( nendo = SHONENDO ; nendo <= SAISHUNENDO ; nendo++ )
	{
		sotai_nendo = nendo - SHONENDO;
		
		for( nenrei = UNDER_63 ; nenrei <= MAX_JUKYU ; nenrei++ )
		{
			for( seibetu = OTOKO ; seibetu <= ONNA ; seibetu++ )
			{
				Kyufu_Nendomatu[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][NEW][ROREI][KYOSHUTU][KIHON][KOUHAN]
				 += Rorei_New[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][NOUFU];
				Kyufu_Nendomatu_P[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][NEW][ROREI][KYOSHUTU][KIHON][KOUHAN]
				 += Rorei_New[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][NOUFU];
				
				Kyufu_Nendomatu[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][OLD][ROREI][KYOSHUTU][KIHON][KOUHAN]
				 += ( Rorei_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][NOUFU]
						   + Rorei_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][KASANOUFU]
				          * ( 1. - tokubetu_kokko_wariai[nendo - ( SHONENDO - 1 )][TOKUBETU_KASAAGE] )
						   + Rorei_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][GONEN]
				          * ( 1. - tokubetu_kokko_wariai[nendo - ( SHONENDO - 1 )][TOKUBETU_GONEN] ) );

				if( nendo == SAISHUNENDO )
				{
					Kyufu_Nendomatu_P[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][OLD][ROREI][KYOSHUTU][KIHON][KOUHAN]
					 += ( Rorei_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][NOUFU]
							   + Rorei_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][KASANOUFU]
					          * ( 1. - tokubetu_kokko_wariai[nendo - ( SHONENDO - 1 )][TOKUBETU_KASAAGE] )
							   + Rorei_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][GONEN]
					          * ( 1. - tokubetu_kokko_wariai[nendo - ( SHONENDO - 1 )][TOKUBETU_GONEN] ) );
				}
				else
				{
					Kyufu_Nendomatu_P[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][OLD][ROREI][KYOSHUTU][KIHON][KOUHAN]
					 += ( Rorei_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][NOUFU]
							   + Rorei_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][KASANOUFU]
					          * ( 1. - tokubetu_kokko_wariai[nendo + 1 - ( SHONENDO - 1 )][TOKUBETU_KASAAGE] )
							   + Rorei_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][GONEN]
					          * ( 1. - tokubetu_kokko_wariai[nendo + 1 - ( SHONENDO - 1 )][TOKUBETU_GONEN] ) );
				}
				
				for( noufu_joutai = MENJO_ZENHAN ; noufu_joutai <= MENJO_KOUHAN ; noufu_joutai++ )
				{
						Kyufu_Nendomatu[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][NEW][ROREI][TOKUBETU][KIHON][KOUHAN]
					 	+= Rorei_New[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][noufu_joutai];
					
						Tokubetukokko_Nendomatu[sotai_nendo][nenrei - NENREI_SUM][TOKUBETU_MENJO][KIHON][KOUHAN]
					 	+= Rorei_New[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][noufu_joutai];
					
					
						Kyufu_Nendomatu_P[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][NEW][ROREI][TOKUBETU][KIHON][KOUHAN]
					 	+= Rorei_New[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][noufu_joutai];
					
						Tokubetukokko_Nendomatu_P[sotai_nendo][nenrei - NENREI_SUM][TOKUBETU_MENJO][KIHON][KOUHAN]
					 	+= Rorei_New[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][noufu_joutai];
				}

				Kyufu_Nendomatu[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][OLD][ROREI][TOKUBETU][KIHON][KOUHAN]
				 += ( Rorei_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][MENJO]
				         * tokubetu_kokko_wariai[nendo - ( SHONENDO - 1 )][TOKUBETU_MENJO]
						   + Rorei_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][KASANOUFU]
				          * tokubetu_kokko_wariai[nendo - ( SHONENDO - 1 )][TOKUBETU_KASAAGE]
						   + Rorei_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][KASAMENJO]
				          * tokubetu_kokko_wariai[nendo - ( SHONENDO - 1 )][TOKUBETU_KASAMENJO]
						   + Rorei_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][ROFUKU_SHITASASAE]
				          * tokubetu_kokko_wariai[nendo - ( SHONENDO - 1 )][TOKUBETU_SHITASASAE]
						   + Rorei_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][GONEN]
				          * tokubetu_kokko_wariai[nendo - ( SHONENDO - 1 )][TOKUBETU_GONEN] );
				
				Tokubetukokko_Nendomatu[sotai_nendo][nenrei - NENREI_SUM][TOKUBETU_MENJO][KIHON][KOUHAN]
				 += Rorei_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][MENJO]
				     * tokubetu_kokko_wariai[nendo - ( SHONENDO - 1 )][TOKUBETU_MENJO];
				
				for( tokubetu_shurui = TOKUBETU_KASAAGE ; tokubetu_shurui <= TOKUBETU_GONEN ; tokubetu_shurui++ )
				{
					Tokubetukokko_Nendomatu[sotai_nendo][nenrei - NENREI_SUM][tokubetu_shurui][KIHON][KOUHAN]
					 += Rorei_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][tokubetu_shurui + 3]
							 * tokubetu_kokko_wariai[nendo - ( SHONENDO - 1 )][tokubetu_shurui];
				}
				
				if( nendo == SAISHUNENDO )
				{
					Kyufu_Nendomatu_P[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][OLD][ROREI][TOKUBETU][KIHON][KOUHAN]
					 += ( Rorei_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][MENJO]
					         * tokubetu_kokko_wariai[nendo - ( SHONENDO - 1 )][TOKUBETU_MENJO]
							   + Rorei_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][KASANOUFU]
					          * tokubetu_kokko_wariai[nendo - ( SHONENDO - 1 )][TOKUBETU_KASAAGE]
							   + Rorei_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][KASAMENJO]
					          * tokubetu_kokko_wariai[nendo - ( SHONENDO - 1 )][TOKUBETU_KASAMENJO]
							   + Rorei_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][GONEN]
					          * tokubetu_kokko_wariai[nendo - ( SHONENDO - 1 )][TOKUBETU_GONEN] );
					
					Tokubetukokko_Nendomatu_P[sotai_nendo][nenrei - NENREI_SUM][TOKUBETU_MENJO][KIHON][KOUHAN]
					 += Rorei_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][MENJO]
					     * tokubetu_kokko_wariai[nendo - ( SHONENDO - 1 )][TOKUBETU_MENJO];
					
					for( tokubetu_shurui = TOKUBETU_KASAAGE ; tokubetu_shurui <= TOKUBETU_GONEN ; tokubetu_shurui++ )
					{
						Tokubetukokko_Nendomatu_P[sotai_nendo][nenrei - NENREI_SUM][tokubetu_shurui][KIHON][KOUHAN]
						 += Rorei_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][tokubetu_shurui + 3]
						     * tokubetu_kokko_wariai[nendo - ( SHONENDO - 1 )][tokubetu_shurui];
					}
				}
				else
				{
					Kyufu_Nendomatu_P[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][OLD][ROREI][TOKUBETU][KIHON][KOUHAN]
					 += ( Rorei_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][MENJO]
					         * tokubetu_kokko_wariai[nendo + 1 - ( SHONENDO - 1 )][TOKUBETU_MENJO]
							   + Rorei_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][KASANOUFU]
					          * tokubetu_kokko_wariai[nendo + 1 - ( SHONENDO - 1 )][TOKUBETU_KASAAGE]
							   + Rorei_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][KASAMENJO]
					          * tokubetu_kokko_wariai[nendo + 1 - ( SHONENDO - 1 )][TOKUBETU_KASAMENJO]
							   + Rorei_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][ROFUKU_SHITASASAE]
					          * tokubetu_kokko_wariai[nendo + 1 - ( SHONENDO - 1 )][TOKUBETU_SHITASASAE]
							   + Rorei_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][GONEN]
					          * tokubetu_kokko_wariai[nendo + 1 - ( SHONENDO - 1 )][TOKUBETU_GONEN] );
					
					Tokubetukokko_Nendomatu_P[sotai_nendo][nenrei - NENREI_SUM][TOKUBETU_MENJO][KIHON][KOUHAN]
					 += Rorei_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][MENJO]
					     * tokubetu_kokko_wariai[nendo + 1 - ( SHONENDO - 1 )][TOKUBETU_MENJO];
					
					for( tokubetu_shurui = TOKUBETU_KASAAGE ; tokubetu_shurui <= TOKUBETU_GONEN ; tokubetu_shurui++ )
					{
						Tokubetukokko_Nendomatu_P[sotai_nendo][nenrei - NENREI_SUM][tokubetu_shurui][KIHON][KOUHAN]
						 += Rorei_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][tokubetu_shurui + 3]
						     * tokubetu_kokko_wariai[nendo + 1 - ( SHONENDO - 1 )][tokubetu_shurui];
					}
				}
				
				for( shikyu_keitai = KIHON ; shikyu_keitai <= KAKYU ; shikyu_keitai++ )
				{
						Kyufu_Nendomatu[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][NEW][SHOGAI][KYOSHUTU][shikyu_keitai][KOUHAN]
						 += ( Shogai_New[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][IPPAN][shikyu_keitai]
							  	 + Shogai_New[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][HATACHIMAE][shikyu_keitai]
					          	* ( 1. - tokubetu_kokko_wariai[nendo - ( SHONENDO - 1 )][TOKUBETU_20MAE] ) ) ;
						if( nendo == SAISHUNENDO )
						{
							Kyufu_Nendomatu_P[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][NEW][SHOGAI][KYOSHUTU][shikyu_keitai][KOUHAN]
						 	+= ( Shogai_New[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][IPPAN][shikyu_keitai]
								   	+ Shogai_New[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][HATACHIMAE][shikyu_keitai]
						          	* ( 1. - tokubetu_kokko_wariai[nendo - ( SHONENDO - 1 )][TOKUBETU_20MAE] ) );
						}
						else
						{
							Kyufu_Nendomatu_P[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][NEW][SHOGAI][KYOSHUTU][shikyu_keitai][KOUHAN]
						 	+= ( Shogai_New[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][IPPAN][shikyu_keitai]
								   	+ Shogai_New[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][HATACHIMAE][shikyu_keitai]
						          	* ( 1. - tokubetu_kokko_wariai[nendo + 1 - ( SHONENDO - 1 )][TOKUBETU_20MAE] ) );
						}

					Kyufu_Nendomatu[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][OLD][SHOGAI][KYOSHUTU][shikyu_keitai][KOUHAN]
					 += Shogai_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][shikyu_keitai][NOUFU];
					Kyufu_Nendomatu_P[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][OLD][SHOGAI][KYOSHUTU][shikyu_keitai][KOUHAN]
					 += Shogai_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][shikyu_keitai][NOUFU];
					
						Kyufu_Nendomatu[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][NEW][SHOGAI][TOKUBETU][shikyu_keitai][KOUHAN]
					 	+= Shogai_New[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][HATACHIMAE][shikyu_keitai]
					     	* tokubetu_kokko_wariai[nendo - ( SHONENDO - 1 )][TOKUBETU_20MAE];
					
						Tokubetukokko_Nendomatu[sotai_nendo][nenrei - NENREI_SUM][TOKUBETU_20MAE][shikyu_keitai][KOUHAN]
					 	+= Shogai_New[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][HATACHIMAE][shikyu_keitai]
					    	 * tokubetu_kokko_wariai[nendo - ( SHONENDO - 1 )][TOKUBETU_20MAE];
					
						if( nendo == SAISHUNENDO )
						{
							Kyufu_Nendomatu_P[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][NEW][SHOGAI][TOKUBETU][shikyu_keitai][KOUHAN]
						 	+= Shogai_New[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][HATACHIMAE][shikyu_keitai]
						     	* tokubetu_kokko_wariai[nendo - ( SHONENDO - 1 )][TOKUBETU_20MAE];
						
							Tokubetukokko_Nendomatu_P[sotai_nendo][nenrei - NENREI_SUM][TOKUBETU_20MAE][shikyu_keitai][KOUHAN]
						 	+= Shogai_New[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][HATACHIMAE][shikyu_keitai]
						     	* tokubetu_kokko_wariai[nendo - ( SHONENDO - 1 )][TOKUBETU_20MAE];
						}
						else
						{
							Kyufu_Nendomatu_P[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][NEW][SHOGAI][TOKUBETU][shikyu_keitai][KOUHAN]
						 	+= Shogai_New[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][HATACHIMAE][shikyu_keitai]
						     	* tokubetu_kokko_wariai[nendo + 1 - ( SHONENDO - 1 )][TOKUBETU_20MAE];
						
							Tokubetukokko_Nendomatu_P[sotai_nendo][nenrei - NENREI_SUM][TOKUBETU_20MAE][shikyu_keitai][KOUHAN]
						 	+= Shogai_New[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][HATACHIMAE][shikyu_keitai]
						     	* tokubetu_kokko_wariai[nendo + 1 - ( SHONENDO - 1 )][TOKUBETU_20MAE];
						}
					
					Kyufu_Nendomatu[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][OLD][SHOGAI][TOKUBETU][shikyu_keitai][KOUHAN]
					 += Shogai_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][shikyu_keitai][MENJO]
					     * tokubetu_kokko_wariai[nendo - ( SHONENDO - 1 )][TOKUBETU_MENJO];
					
					Tokubetukokko_Nendomatu[sotai_nendo][nenrei - NENREI_SUM][TOKUBETU_MENJO][shikyu_keitai][KOUHAN]
					 += Shogai_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][shikyu_keitai][MENJO]
					     * tokubetu_kokko_wariai[nendo - ( SHONENDO - 1 )][TOKUBETU_MENJO];
					
					if( nendo == SAISHUNENDO )
					{
						Kyufu_Nendomatu_P[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][OLD][SHOGAI][TOKUBETU][shikyu_keitai][KOUHAN]
						 += Shogai_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][shikyu_keitai][MENJO]
						     * tokubetu_kokko_wariai[nendo - ( SHONENDO - 1 )][TOKUBETU_MENJO];
						
						Tokubetukokko_Nendomatu_P[sotai_nendo][nenrei - NENREI_SUM][TOKUBETU_MENJO][shikyu_keitai][KOUHAN]
						 += Shogai_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][shikyu_keitai][MENJO]
						     * tokubetu_kokko_wariai[nendo - ( SHONENDO - 1 )][TOKUBETU_MENJO];
					}
					else
					{
						Kyufu_Nendomatu_P[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][OLD][SHOGAI][TOKUBETU][shikyu_keitai][KOUHAN]
						 += Shogai_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][shikyu_keitai][MENJO]
						     * tokubetu_kokko_wariai[nendo + 1 - ( SHONENDO - 1 )][TOKUBETU_MENJO];
						
						Tokubetukokko_Nendomatu_P[sotai_nendo][nenrei - NENREI_SUM][TOKUBETU_MENJO][shikyu_keitai][KOUHAN]
						 += Shogai_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][shikyu_keitai][MENJO]
						     * tokubetu_kokko_wariai[nendo + 1 - ( SHONENDO - 1 )][TOKUBETU_MENJO];
					}
					
					Kyufu_Nendomatu[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][NEW][IZOKU][KYOSHUTU][shikyu_keitai][KOUHAN]
					 += Izoku_New[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][shikyu_keitai];
					Kyufu_Nendomatu_P[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][NEW][IZOKU][KYOSHUTU][shikyu_keitai][KOUHAN]
					 += Izoku_New[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][shikyu_keitai];
					
					Kyufu_Nendomatu[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][OLD][IZOKU][KYOSHUTU][shikyu_keitai][KOUHAN]
					 += Izoku_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][shikyu_keitai][NOUFU];
					Kyufu_Nendomatu_P[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][OLD][IZOKU][KYOSHUTU][shikyu_keitai][KOUHAN]
					 += Izoku_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][shikyu_keitai][NOUFU];
					
					Kyufu_Nendomatu[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][OLD][IZOKU][TOKUBETU][shikyu_keitai][KOUHAN]
					 += Izoku_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][shikyu_keitai][MENJO]
					     * tokubetu_kokko_wariai[nendo - ( SHONENDO - 1 )][TOKUBETU_MENJO];
					
					Tokubetukokko_Nendomatu[sotai_nendo][nenrei - NENREI_SUM][TOKUBETU_MENJO][shikyu_keitai][KOUHAN]
					 += Izoku_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][shikyu_keitai][MENJO]
					     * tokubetu_kokko_wariai[nendo - ( SHONENDO - 1 )][TOKUBETU_MENJO];
					
					if( nendo == SAISHUNENDO )
					{
						Kyufu_Nendomatu_P[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][OLD][IZOKU][TOKUBETU][shikyu_keitai][KOUHAN]
						 += Izoku_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][shikyu_keitai][MENJO]
						     * tokubetu_kokko_wariai[nendo - ( SHONENDO - 1 )][TOKUBETU_MENJO];
						
						Tokubetukokko_Nendomatu_P[sotai_nendo][nenrei - NENREI_SUM][TOKUBETU_MENJO][shikyu_keitai][KOUHAN]
						 += Izoku_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][shikyu_keitai][MENJO]
						     * tokubetu_kokko_wariai[nendo - ( SHONENDO - 1 )][TOKUBETU_MENJO];
					}
					else
					{
						Kyufu_Nendomatu_P[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][OLD][IZOKU][TOKUBETU][shikyu_keitai][KOUHAN]
						 += Izoku_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][shikyu_keitai][MENJO]
						     * tokubetu_kokko_wariai[nendo + 1 - ( SHONENDO - 1 )][TOKUBETU_MENJO];
						
						Tokubetukokko_Nendomatu_P[sotai_nendo][nenrei - NENREI_SUM][TOKUBETU_MENJO][shikyu_keitai][KOUHAN]
						 += Izoku_Old[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][seibetu][shikyu_keitai][MENJO]
						     * tokubetu_kokko_wariai[nendo + 1 - ( SHONENDO - 1 )][TOKUBETU_MENJO];
					}
				}
				
				for( seido = KOKUNEN ; seido <= SHIGAKU ; seido++ )
				{
					Kyufu_Nendomatu[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][NEW][ROREI][KYOSHUTU][KIHON][KOUHAN]
					 += FurikaeKasan[seido][sotai_nendo][nenrei - NENREI_SUM][seibetu][ROREI];
					Kyufu_Nendomatu_P[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][NEW][ROREI][KYOSHUTU][KIHON][KOUHAN]
					 += FurikaeKasan[seido][sotai_nendo][nenrei - NENREI_SUM][seibetu][ROREI];
					
					Kyufu_Nendomatu[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][NEW][SHOGAI][KYOSHUTU][KIHON][KOUHAN]
					 += FurikaeKasan[seido][sotai_nendo][nenrei - NENREI_SUM][seibetu][SHOGAI];
					Kyufu_Nendomatu_P[KOKUNEN][sotai_nendo][nenrei - NENREI_SUM][NEW][SHOGAI][KYOSHUTU][KIHON][KOUHAN]
					 += FurikaeKasan[seido][sotai_nendo][nenrei - NENREI_SUM][seibetu][SHOGAI];
				}
				
				for( seido = KOUNEN ; seido <= SHIGAKU ; seido++ )
				{
					Kyufu_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][NEW][ROREI][KYOSHUTU][KIHON][KOUHAN]
					 += Rorei_New[seido][sotai_nendo][nenrei - NENREI_SUM][seibetu][NOUFU];
					Kyufu_Nendomatu_P[seido][sotai_nendo][nenrei - NENREI_SUM][NEW][ROREI][KYOSHUTU][KIHON][KOUHAN]
					 += Rorei_New[seido][sotai_nendo][nenrei - NENREI_SUM][seibetu][NOUFU];

					Kyufu_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][OLD][ROREI][KYOSHUTU][KIHON][KOUHAN]
					 += ( Rorei_Old[seido][sotai_nendo][nenrei - NENREI_SUM][seibetu][NOUFU]
							   + Rorei_Old[seido][sotai_nendo][nenrei - NENREI_SUM][seibetu][KASANOUFU]
							   + Rorei_Old[seido][sotai_nendo][nenrei - NENREI_SUM][seibetu][GONEN] );
					Kyufu_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][OLD][ROREI][KYOSHUTU][KAKYU][KOUHAN]
					 += Rorei_Old[seido][sotai_nendo][nenrei - NENREI_SUM][seibetu][KAKYU_NOUFU];
					
					Kyufu_Nendomatu_P[seido][sotai_nendo][nenrei - NENREI_SUM][OLD][ROREI][KYOSHUTU][KIHON][KOUHAN]
					 += ( Rorei_Old[seido][sotai_nendo][nenrei - NENREI_SUM][seibetu][NOUFU]
							   + Rorei_Old[seido][sotai_nendo][nenrei - NENREI_SUM][seibetu][KASANOUFU]
							   + Rorei_Old[seido][sotai_nendo][nenrei - NENREI_SUM][seibetu][GONEN] );
					Kyufu_Nendomatu_P[seido][sotai_nendo][nenrei - NENREI_SUM][OLD][ROREI][KYOSHUTU][KAKYU][KOUHAN]
					 += Rorei_Old[seido][sotai_nendo][nenrei - NENREI_SUM][seibetu][KAKYU_NOUFU];
					
					for( shikyu_keitai = KIHON ; shikyu_keitai <= KAKYU ; shikyu_keitai++ )
					{
						Kyufu_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][NEW][SHOGAI][KYOSHUTU][shikyu_keitai][KOUHAN]
						 += ( Shogai_New[seido][sotai_nendo][nenrei - NENREI_SUM][seibetu][IPPAN][shikyu_keitai]
								   + Shogai_New[seido][sotai_nendo][nenrei - NENREI_SUM][seibetu][HATACHIMAE][shikyu_keitai] );
						Kyufu_Nendomatu_P[seido][sotai_nendo][nenrei - NENREI_SUM][NEW][SHOGAI][KYOSHUTU][shikyu_keitai][KOUHAN]
						 += ( Shogai_New[seido][sotai_nendo][nenrei - NENREI_SUM][seibetu][IPPAN][shikyu_keitai]
								   + Shogai_New[seido][sotai_nendo][nenrei - NENREI_SUM][seibetu][HATACHIMAE][shikyu_keitai] );
						
						Kyufu_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][OLD][SHOGAI][KYOSHUTU][shikyu_keitai][KOUHAN]
						 += Shogai_Old[seido][sotai_nendo][nenrei - NENREI_SUM][seibetu][shikyu_keitai][NOUFU];
						Kyufu_Nendomatu_P[seido][sotai_nendo][nenrei - NENREI_SUM][OLD][SHOGAI][KYOSHUTU][shikyu_keitai][KOUHAN]
						 += Shogai_Old[seido][sotai_nendo][nenrei - NENREI_SUM][seibetu][shikyu_keitai][NOUFU];
						
						Kyufu_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][NEW][IZOKU][KYOSHUTU][shikyu_keitai][KOUHAN]
						 += Izoku_New[seido][sotai_nendo][nenrei - NENREI_SUM][seibetu][shikyu_keitai] * ( 16 - tuki[sotai_nendo] ) / 12.;
						Kyufu_Nendomatu_P[seido][sotai_nendo][nenrei - NENREI_SUM][NEW][IZOKU][KYOSHUTU][shikyu_keitai][KOUHAN]
						 += Izoku_New[seido][sotai_nendo][nenrei - NENREI_SUM][seibetu][shikyu_keitai] * ( 16 - tuki[sotai_nendo] ) / 12.;
						
						Kyufu_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][OLD][IZOKU][KYOSHUTU][shikyu_keitai][KOUHAN]
						 += Izoku_Old[seido][sotai_nendo][nenrei - NENREI_SUM][seibetu][shikyu_keitai][NOUFU] * ( 16 - tuki[sotai_nendo] ) / 12.;
						Kyufu_Nendomatu_P[seido][sotai_nendo][nenrei - NENREI_SUM][OLD][IZOKU][KYOSHUTU][shikyu_keitai][KOUHAN]
						 += Izoku_Old[seido][sotai_nendo][nenrei - NENREI_SUM][seibetu][shikyu_keitai][NOUFU] * ( 16 - tuki[sotai_nendo] ) / 12.;
					}
				}
			}

			for( seido = KOKUNEN ; seido <= SHIGAKU ; seido++ )
			{
				for( shinkyu = NEW ; shinkyu <= OLD ; shinkyu++ )
				{
					for( kubun = ROREI ; kubun <= IZOKU ; kubun++ )
					{
						for( taishou = KYOSHUTU ; taishou <= TOKUBETU ; taishou++ )
						{
							for( shikyu_keitai = KIHON ; shikyu_keitai <= KAKYU ; shikyu_keitai++ )
							{
								for( kikan = ZENHAN ; kikan <= KOUHAN ; kikan++ )
								{
									Kyufu_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan]
									   *= Cut_ritu[sotai_nendo][( shikyu_keitai == KAKYU ? UNDER_63  - UNDER_63 : nenrei - UNDER_63 )];
									Kyufu_Nendomatu_P[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan]
									   *= Cut_ritu[sotai_nendo][( shikyu_keitai == KAKYU ? UNDER_63  - UNDER_63 : nenrei - UNDER_63 )];

									if( taishou == KYOSHUTU )
									{
									  Kokko_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan]
									  = Kyufu_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan] *Kokko_Wariai[nendo - (SHONENDO - 1)];
									  Kokko_Nendomatu_P[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan]
									  = Kyufu_Nendomatu_P[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan] *Kokko_Wariai[nendo - (SHONENDO - 1)];
									}

								  if( taishou == KYOSHUTU )
								  {
									Kyufu_Nendomatu[SUM][sotai_nendo][nenrei - NENREI_SUM][SUM][SUM][KYOSHUTU][shikyu_keitai][kikan]
										 += Kyufu_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan];
									Kyufu_Nendomatu[SUM][sotai_nendo][nenrei - NENREI_SUM][SUM][SUM][KYOSHUTU][SUM][kikan]
										 += Kyufu_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan];
									Kyufu_Nendomatu[SUM][sotai_nendo][nenrei - NENREI_SUM][SUM][SUM][KYOSHUTU][SUM][SUM]
										 += Kyufu_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan];
								  	Kyufu_Nendomatu_P[SUM][sotai_nendo][nenrei - NENREI_SUM][SUM][SUM][KYOSHUTU][shikyu_keitai][kikan]
								  	 += Kyufu_Nendomatu_P[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan];
								  	Kyufu_Nendomatu_P[SUM][sotai_nendo][nenrei - NENREI_SUM][SUM][SUM][KYOSHUTU][SUM][kikan]
								  	 += Kyufu_Nendomatu_P[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan];
								  	Kyufu_Nendomatu_P[SUM][sotai_nendo][nenrei - NENREI_SUM][SUM][SUM][KYOSHUTU][SUM][SUM]
								  	 += Kyufu_Nendomatu_P[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan];

									Kokko_Nendomatu[SUM][sotai_nendo][nenrei - NENREI_SUM][SUM][SUM][shikyu_keitai][kikan]
										 += Kokko_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan];
									Kokko_Nendomatu[SUM][sotai_nendo][nenrei - NENREI_SUM][SUM][SUM][SUM][kikan]
										 += Kokko_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan];
									Kokko_Nendomatu[SUM][sotai_nendo][nenrei - NENREI_SUM][SUM][SUM][SUM][SUM]
										 += Kokko_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan];
								  	Kokko_Nendomatu_P[SUM][sotai_nendo][nenrei - NENREI_SUM][SUM][SUM][shikyu_keitai][kikan]
								  	 += Kokko_Nendomatu_P[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan];
								  	Kokko_Nendomatu_P[SUM][sotai_nendo][nenrei - NENREI_SUM][SUM][SUM][SUM][kikan]
								  	 += Kokko_Nendomatu_P[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan];
								  	Kokko_Nendomatu_P[SUM][sotai_nendo][nenrei - NENREI_SUM][SUM][SUM][SUM][SUM]
								  	 += Kokko_Nendomatu_P[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan];
								  }

								  Kyufu_Nendomatu[SUM][sotai_nendo][nenrei - NENREI_SUM][SUM][SUM][taishou][shikyu_keitai][SUM]
								   += Kyufu_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan];
								  Kyufu_Nendomatu_P[SUM][sotai_nendo][nenrei - NENREI_SUM][SUM][SUM][taishou][shikyu_keitai][SUM]
								   += Kyufu_Nendomatu_P[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan];

								  if( taishou == KYOSHUTU )
								  {
								  	Kokko_Nendomatu[SUM][sotai_nendo][nenrei - NENREI_SUM][SUM][SUM][shikyu_keitai][SUM]
								   	+= Kokko_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan];
								  	Kokko_Nendomatu_P[SUM][sotai_nendo][nenrei - NENREI_SUM][SUM][SUM][shikyu_keitai][SUM]
								   	+= Kokko_Nendomatu_P[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan];
								  }

								}
							}
						}
					}
				}
			}

			for( tokubetu_shurui = TOKUBETU_MENJO ; tokubetu_shurui <= TOKUBETU_20MAE ; tokubetu_shurui++ )
			{
				for( shikyu_keitai = KIHON ; shikyu_keitai <= KAKYU ; shikyu_keitai++ )
				{
					for( kikan = ZENHAN ; kikan <= KOUHAN ; kikan++ )
					{
						Tokubetukokko_Nendomatu[sotai_nendo][nenrei - NENREI_SUM][tokubetu_shurui][shikyu_keitai][kikan]
						 *= Cut_ritu[sotai_nendo][( shikyu_keitai == KAKYU ? UNDER_63  - UNDER_63 : nenrei - UNDER_63 )];
						Tokubetukokko_Nendomatu_P[sotai_nendo][nenrei - NENREI_SUM][tokubetu_shurui][shikyu_keitai][kikan]
						 *= Cut_ritu[sotai_nendo][( shikyu_keitai == KAKYU ? UNDER_63  - UNDER_63 : nenrei - UNDER_63 )];
						
						Tokubetukokko_Nendomatu[sotai_nendo][nenrei - NENREI_SUM][SUM][shikyu_keitai][kikan]
						 += Tokubetukokko_Nendomatu[sotai_nendo][nenrei - NENREI_SUM][tokubetu_shurui][shikyu_keitai][kikan];
						Tokubetukokko_Nendomatu_P[sotai_nendo][nenrei - NENREI_SUM][SUM][shikyu_keitai][kikan]
						 += Tokubetukokko_Nendomatu_P[sotai_nendo][nenrei - NENREI_SUM][tokubetu_shurui][shikyu_keitai][kikan];
					}
				}
			}
		}
	}

	for( nendo = SHONENDO + 1 ; nendo <= SAISHUNENDO ; nendo++ )
	{
		sotai_nendo = nendo - SHONENDO;
		
		for( seido = KOKUNEN ; seido <= SHIGAKU ; seido++ )
		{
			for( nenrei = UNDER_64 ; nenrei <= MAX_JUKYU ; nenrei++ )
			{
				for( shinkyu = NEW ; shinkyu <= OLD ; shinkyu++ )
				{
					for( kubun = ROREI ; kubun <= IZOKU ; kubun++ )
					{
						for( taishou = KYOSHUTU ; taishou <= TOKUBETU ; taishou++ )
						{
							for( shikyu_keitai = KIHON ; shikyu_keitai <= KAKYU ; shikyu_keitai++ )
							{
								for( kikan = ZENHAN ; kikan <= KOUHAN ; kikan++ )
								{
									if( nenrei == UNDER_64 )
									{
										if( nendo == 2013 )
										{
											Kyufu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan]
											 = Kyufu_Nendomatu_P[seido][sotai_nendo - 1][nenrei - 1 - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan]
											     * ( SHIHARAIOKURE + ( kaiteiritu[nendo - ECON_SHONENDO][UNDER_67 - UNDER_67] + zoubun ) * 6. ) / 12.
											    + ( Kyufu_Nendomatu[seido][sotai_nendo][nenrei - 1 - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan]
											         + Kyufu_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan] )
											       * ( 6. - SHIHARAIOKURE ) / 12.;

											if( taishou == KYOSHUTU )
											{
											  Kokko[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan]
											   = Kokko_Nendomatu_P[seido][sotai_nendo - 1][nenrei - 1 - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan]
											     * ( SHIHARAIOKURE + ( kaiteiritu[nendo - ECON_SHONENDO][UNDER_67 - UNDER_67] + zoubun ) * 6. ) / 12.
											    + ( Kokko_Nendomatu[seido][sotai_nendo][nenrei - 1 - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan]
											         + Kokko_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan] )
											       * ( 6. - SHIHARAIOKURE ) / 12.;
											}

										}
										else
										{
											Kyufu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan]
											 = Kyufu_Nendomatu_P[seido][sotai_nendo - 1][nenrei - 1 - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan]
											     * ( SHIHARAIOKURE + kaiteiritu[nendo - ECON_SHONENDO][UNDER_67 - UNDER_67] * ( nendo == 2015 ? Cut_2015 : 1. ) * 6. ) / 12.
											    + ( Kyufu_Nendomatu[seido][sotai_nendo][nenrei - 1 - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan]
											         + Kyufu_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan] )
											       * ( 6. - SHIHARAIOKURE ) / 12.;

											if( taishou == KYOSHUTU )
											{
											  Kokko[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan]
											   = Kokko_Nendomatu_P[seido][sotai_nendo - 1][nenrei - 1 - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan]
											     * ( SHIHARAIOKURE + kaiteiritu[nendo - ECON_SHONENDO][UNDER_67 - UNDER_67] * ( nendo == 2015 ? Cut_2015 : 1. ) * 6. ) / 12.
											    + ( Kokko_Nendomatu[seido][sotai_nendo][nenrei - 1 - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan]
											         + Kokko_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan] )
											       * ( 6. - SHIHARAIOKURE ) / 12.;

											}
										}
									}
									else if( nenrei <= 67 )
									{
										if( nendo == 2013 )
										{
											Kyufu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan]
											 = Kyufu_Nendomatu_P[seido][sotai_nendo - 1][nenrei - 1 - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan]
											     * ( SHIHARAIOKURE + ( kaiteiritu[nendo - ECON_SHONENDO][UNDER_67 - UNDER_67] + zoubun ) * 6. ) / 12.
											    + Kyufu_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan]
											       * ( 6. - SHIHARAIOKURE ) / 12.;

											if( taishou == KYOSHUTU )
											{
 											  Kokko[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan]
											   = Kokko_Nendomatu_P[seido][sotai_nendo - 1][nenrei - 1 - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan]
											     * ( SHIHARAIOKURE + ( kaiteiritu[nendo - ECON_SHONENDO][UNDER_67 - UNDER_67] + zoubun ) * 6. ) / 12.
											    + Kokko_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan]
											       * ( 6. - SHIHARAIOKURE ) / 12.;
											}

										}
										else
										{
											Kyufu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan]
											 = Kyufu_Nendomatu_P[seido][sotai_nendo - 1][nenrei - 1 - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan]
											     * ( SHIHARAIOKURE + kaiteiritu[nendo - ECON_SHONENDO][UNDER_67 - UNDER_67] * ( nendo == 2015 ? Cut_2015 : 1. ) * 6. ) / 12.
											    + Kyufu_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan]
											       * ( 6. - SHIHARAIOKURE ) / 12.;

											if( taishou == KYOSHUTU )
											{
											Kokko[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan]
											 = Kokko_Nendomatu_P[seido][sotai_nendo - 1][nenrei - 1 - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan]
											     * ( SHIHARAIOKURE + kaiteiritu[nendo - ECON_SHONENDO][UNDER_67 - UNDER_67] * ( nendo == 2015 ? Cut_2015 : 1. ) * 6. ) / 12.
											    + Kokko_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan]
											       * ( 6. - SHIHARAIOKURE ) / 12.;
											}
										}
									}
									else
									{
										if( nendo == 2013 )
										{
											Kyufu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan]
											 = Kyufu_Nendomatu_P[seido][sotai_nendo - 1][nenrei - 1 - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan]
											     * ( SHIHARAIOKURE
											          + ( kaiteiritu[nendo - ECON_SHONENDO][( shikyu_keitai == KAKYU ? UNDER_67 - UNDER_67 : nenrei - UNDER_67 )] + zoubun ) * 6. ) / 12.
											    + Kyufu_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan]
											       * ( 6. - SHIHARAIOKURE ) / 12.;

											if( taishou == KYOSHUTU )
											{

											  Kokko[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan]
											   = Kokko_Nendomatu_P[seido][sotai_nendo - 1][nenrei - 1 - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan]
											     * ( SHIHARAIOKURE
											          + ( kaiteiritu[nendo - ECON_SHONENDO][( shikyu_keitai == KAKYU ? UNDER_67 - UNDER_67 : nenrei - UNDER_67 )] + zoubun ) * 6. ) / 12.
											    + Kokko_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan]
											       * ( 6. - SHIHARAIOKURE ) / 12.;

											}

										}
										else
										{
											Kyufu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan]
											 = Kyufu_Nendomatu_P[seido][sotai_nendo - 1][nenrei - 1 - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan]
											     * ( SHIHARAIOKURE
											          + kaiteiritu[nendo - ECON_SHONENDO][( shikyu_keitai == KAKYU ? UNDER_67 - UNDER_67 : nenrei - UNDER_67 )] * ( nendo == 2015 ? Cut_2015 : 1. ) * 6.  ) / 12.
											    + Kyufu_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan]
											       * ( 6. - SHIHARAIOKURE ) / 12.;

											if( taishou == KYOSHUTU )
											{
											  Kokko[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan]
											   = Kokko_Nendomatu_P[seido][sotai_nendo - 1][nenrei - 1 - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan]
											     * ( SHIHARAIOKURE
											          + kaiteiritu[nendo - ECON_SHONENDO][( shikyu_keitai == KAKYU ? UNDER_67 - UNDER_67 : nenrei - UNDER_67 )] * ( nendo == 2015 ? Cut_2015 : 1. ) * 6. ) / 12.
											    + Kokko_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan]
											       * ( 6. - SHIHARAIOKURE ) / 12.;
											}

										}
									}
								}
							}
						}
					}
				}
				
				for( tokubetu_shurui = SUM ; tokubetu_shurui <= TOKUBETU_20MAE ; tokubetu_shurui++ )
				{
					for( shikyu_keitai = SUM ; shikyu_keitai <= KAKYU ; shikyu_keitai++ )
					{
						for( kikan = SUM ; kikan <= KOUHAN ; kikan++ )
						{
							if( nenrei == UNDER_64 )
							{
								if( nendo == 2013 )
								{
									Tokubetukokko[sotai_nendo][nenrei - NENREI_SUM][tokubetu_shurui][shikyu_keitai][kikan]
									 = Tokubetukokko_Nendomatu_P[sotai_nendo - 1][nenrei - 1 - NENREI_SUM][tokubetu_shurui][shikyu_keitai][kikan]
									     * ( SHIHARAIOKURE + ( kaiteiritu[nendo - ECON_SHONENDO][UNDER_67 - UNDER_67] + zoubun ) * 6. ) / 12.
									    + ( Tokubetukokko_Nendomatu[sotai_nendo][nenrei - 1 - NENREI_SUM][tokubetu_shurui][shikyu_keitai][kikan]
									           + Tokubetukokko_Nendomatu[sotai_nendo][nenrei - NENREI_SUM][tokubetu_shurui][shikyu_keitai][kikan] )
									          * ( 6. - SHIHARAIOKURE ) / 12.;
								}
								else
								{
									Tokubetukokko[sotai_nendo][nenrei - NENREI_SUM][tokubetu_shurui][shikyu_keitai][kikan]
									 = Tokubetukokko_Nendomatu_P[sotai_nendo - 1][nenrei - 1 - NENREI_SUM][tokubetu_shurui][shikyu_keitai][kikan]
									     * ( SHIHARAIOKURE + kaiteiritu[nendo - ECON_SHONENDO][UNDER_67 - UNDER_67] * ( nendo == 2015 ? Cut_2015 : 1. ) * 6. ) / 12.
									    + ( Tokubetukokko_Nendomatu[sotai_nendo][nenrei - 1 - NENREI_SUM][tokubetu_shurui][shikyu_keitai][kikan]
									           + Tokubetukokko_Nendomatu[sotai_nendo][nenrei - NENREI_SUM][tokubetu_shurui][shikyu_keitai][kikan] )
									          * ( 6. - SHIHARAIOKURE ) / 12.;
								}
							}
							else if( nenrei <= 67 )
							{
								if( nendo == 2013 )
								{
									Tokubetukokko[sotai_nendo][nenrei - NENREI_SUM][tokubetu_shurui][shikyu_keitai][kikan]
									 = Tokubetukokko_Nendomatu_P[sotai_nendo - 1][nenrei - 1 - NENREI_SUM][tokubetu_shurui][shikyu_keitai][kikan]
									     * ( SHIHARAIOKURE + ( kaiteiritu[nendo - ECON_SHONENDO][UNDER_67 - UNDER_67] + zoubun ) * 6. ) / 12.
									    + Tokubetukokko_Nendomatu[sotai_nendo][nenrei - NENREI_SUM][tokubetu_shurui][shikyu_keitai][kikan] * ( 6. - SHIHARAIOKURE ) / 12.;
								}
								else
								{
									Tokubetukokko[sotai_nendo][nenrei - NENREI_SUM][tokubetu_shurui][shikyu_keitai][kikan]
									 = Tokubetukokko_Nendomatu_P[sotai_nendo - 1][nenrei - 1 - NENREI_SUM][tokubetu_shurui][shikyu_keitai][kikan]
									     * ( SHIHARAIOKURE + kaiteiritu[nendo - ECON_SHONENDO][UNDER_67 - UNDER_67] * ( nendo == 2015 ? Cut_2015 : 1. ) * 6. ) / 12.
									    + Tokubetukokko_Nendomatu[sotai_nendo][nenrei - NENREI_SUM][tokubetu_shurui][shikyu_keitai][kikan] * ( 6. - SHIHARAIOKURE ) / 12.;
								}
							}
							else
							{
								if( nendo == 2013 )
								{
									Tokubetukokko[sotai_nendo][nenrei - NENREI_SUM][tokubetu_shurui][shikyu_keitai][kikan]
									 = Tokubetukokko_Nendomatu_P[sotai_nendo - 1][nenrei - 1 - NENREI_SUM][tokubetu_shurui][shikyu_keitai][kikan]
									     * ( SHIHARAIOKURE + ( kaiteiritu[nendo - ECON_SHONENDO][( shikyu_keitai == KAKYU ? UNDER_67 - UNDER_67 : nenrei - UNDER_67 )] + zoubun ) * 6. ) / 12.
									    + Tokubetukokko_Nendomatu[sotai_nendo][nenrei - NENREI_SUM][tokubetu_shurui][shikyu_keitai][kikan] * ( 6. - SHIHARAIOKURE ) / 12.;
								}
								else
								{
									Tokubetukokko[sotai_nendo][nenrei - NENREI_SUM][tokubetu_shurui][shikyu_keitai][kikan]
									 = Tokubetukokko_Nendomatu_P[sotai_nendo - 1][nenrei - 1 - NENREI_SUM][tokubetu_shurui][shikyu_keitai][kikan]
									     * ( SHIHARAIOKURE + kaiteiritu[nendo - ECON_SHONENDO][( shikyu_keitai == KAKYU ? UNDER_67 - UNDER_67 : nenrei - UNDER_67 )] * ( nendo == 2015 ? Cut_2015 : 1. ) * 6.  ) / 12.
									    + Tokubetukokko_Nendomatu[sotai_nendo][nenrei - NENREI_SUM][tokubetu_shurui][shikyu_keitai][kikan] * ( 6. - SHIHARAIOKURE ) / 12.;
								}
							}
						}
					}
				}
			}
		}
	}
	
	for( nendo = SHONENDO + 1 ; nendo <= SAISHUNENDO ; nendo++ )
	{
		sotai_nendo = nendo - SHONENDO;
		for( nenrei = UNDER_64 ; nenrei <= MAX_JUKYU ; nenrei++ )
		{
			for( seido = KOKUNEN ; seido <= SHIGAKU ; seido++ )
			{
				for( shinkyu = NEW ; shinkyu <= OLD ; shinkyu++ )
				{
					for( kubun = ROREI ; kubun <= IZOKU ; kubun++ )
					{
						for( taishou = KYOSHUTU ; taishou <= TOKUBETU ; taishou++ )
						{
							for( shikyu_keitai = KIHON ; shikyu_keitai <= KAKYU ; shikyu_keitai++ )
							{
								for( kikan = ZENHAN ; kikan <= KOUHAN ; kikan++ )
								{
									Kyufu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][SUM][kikan]
									 += Kyufu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan];
									Kyufu[seido][sotai_nendo][NENREI_SUM - NENREI_SUM][shinkyu][kubun][taishou][SUM][kikan]
									 += Kyufu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan];

									if( taishou == KYOSHUTU )
									{
									  Kokko[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][SUM][kikan]
									  += Kokko[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan];
									  Kokko[seido][sotai_nendo][NENREI_SUM - NENREI_SUM][shinkyu][kubun][SUM][kikan]
									  += Kokko[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan];
									}
								}
							}
						}
					}
				}
			}
			
			for( seido = KOKUNEN ; seido <= SHIGAKU ; seido++ )
			{
				for( shinkyu = NEW ; shinkyu <= OLD ; shinkyu++ )
				{
					for( kubun = ROREI ; kubun <= IZOKU ; kubun++ )
					{
						for( taishou = KYOSHUTU ; taishou <= TOKUBETU ; taishou++ )
						{
							for( shikyu_keitai = SUM ; shikyu_keitai <= KAKYU ; shikyu_keitai++ )
							{
								for( kikan = ZENHAN ; kikan <= KOUHAN ; kikan++ )
								{
								  Kyufu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][SUM][shikyu_keitai][kikan]
									 += Kyufu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan];
									Kyufu[seido][sotai_nendo][NENREI_SUM - NENREI_SUM][shinkyu][kubun][SUM][shikyu_keitai][kikan]
									 += Kyufu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan];

									if( taishou == KYOSHUTU )
									{
									  Kokko[seido][sotai_nendo][NENREI_SUM - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan]
										 += Kokko[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan];
									}
								}
							}
						}
					}
				}
			}
			
			for( seido = KOKUNEN ; seido <= SHIGAKU ; seido ++ )
			{
				for( shinkyu = NEW ; shinkyu <= OLD ; shinkyu ++)
				{
					for( kubun = ROREI ; kubun <= IZOKU ; kubun ++ )
					{
						for( taishou = SUM ; taishou <= TOKUBETU ; taishou ++ )
						{
							for( shikyu_keitai = SUM ; shikyu_keitai <= KAKYU ; shikyu_keitai ++ )
							{
								for( kikan = ZENHAN ; kikan <= KOUHAN ; kikan++ )
								{
									Kyufu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][SUM][taishou][shikyu_keitai][kikan]
									 += Kyufu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan];
									
									Kyufu[seido][sotai_nendo][NENREI_SUM - NENREI_SUM][shinkyu][SUM][taishou][shikyu_keitai][kikan]
									 += Kyufu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan];
                                                                        
									if( taishou == KYOSHUTU )
									{
									  Kokko[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][SUM][shikyu_keitai][kikan]
									   += Kokko[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan];
									
									  Kokko[seido][sotai_nendo][NENREI_SUM - NENREI_SUM][shinkyu][SUM][shikyu_keitai][kikan]
									   += Kokko[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan];
									}
								}
							}
						}
					}
				}
			}
			
			for( seido = KOKUNEN ; seido <= SHIGAKU ; seido ++ )
			{
				for( shinkyu = NEW ; shinkyu <= OLD ; shinkyu ++)
				{
					for( kubun = SUM ; kubun <= IZOKU ; kubun ++ )
					{
						for( taishou = SUM ; taishou <= TOKUBETU ; taishou ++ )
						{
							for( shikyu_keitai = SUM ; shikyu_keitai <= KAKYU ; shikyu_keitai ++ )
							{
								for( kikan = ZENHAN ; kikan <= KOUHAN ; kikan++ )
								{
									Kyufu[seido][sotai_nendo][nenrei - NENREI_SUM][SUM][kubun][taishou][shikyu_keitai][kikan]
									 += Kyufu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan];
									Kyufu[seido][sotai_nendo][NENREI_SUM - NENREI_SUM][SUM][kubun][taishou][shikyu_keitai][kikan]
									 += Kyufu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan];
                                                                        
									if( taishou == KYOSHUTU )
									{
									  Kokko[seido][sotai_nendo][nenrei - NENREI_SUM][SUM][kubun][shikyu_keitai][kikan]
									   += Kokko[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan];
								 	  Kokko[seido][sotai_nendo][NENREI_SUM - NENREI_SUM][SUM][kubun][shikyu_keitai][kikan]
									   += Kokko[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan];
									}
								}
							}
						}
					}
				}
			}

			
			for( seido = KOKUNEN ; seido <= SHIGAKU ; seido++ )
			{
				for( shinkyu = SUM ; shinkyu <= OLD ; shinkyu++ )
				{
					for( kubun = SUM ; kubun <= IZOKU ; kubun++ )
					{
						for( taishou = SUM ; taishou <= TOKUBETU ; taishou++ )
						{
							for( shikyu_keitai = SUM ; shikyu_keitai <= KAKYU ; shikyu_keitai++ )
							{
								for( kikan = ZENHAN ; kikan <= KOUHAN ; kikan++ )
								{
								  Kyufu[SUM][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan]
									 += Kyufu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan];
									Kyufu[SUM][sotai_nendo][NENREI_SUM - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan]
									 += Kyufu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][kikan];
                                                                  
									if( taishou == KYOSHUTU )
									{
									  Kokko[SUM][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan]
									 += Kokko[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan];
									Kokko[SUM][sotai_nendo][NENREI_SUM - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan]
									 += Kokko[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][kikan];
									}
								}
							}
						}
					}
				}
			}

			for( seido = KOKUNEN ; seido <= SHIGAKU ; seido++ )
			{
				for( shinkyu = NEW ; shinkyu <= OLD ; shinkyu++ )
				{
					for( kubun = ROREI ; kubun <= IZOKU ; kubun++ )
					{
						for( shikyu_keitai = KIHON ; shikyu_keitai <= KAKYU ; shikyu_keitai++ )
						{
							for( kikan = ZENHAN ; kikan <= KOUHAN ; kikan++ )
							{

							}
						}
					}
				}
			}

			for( seido = SUM ; seido <= SHIGAKU ; seido++ )
			{
				for( shinkyu = SUM ; shinkyu <= OLD ; shinkyu++ )
				{
					for( kubun = SUM ; kubun <= IZOKU ; kubun++ )
					{
						for( taishou = SUM ; taishou <= TOKUBETU ; taishou++ )
						{
							for( shikyu_keitai = SUM ; shikyu_keitai <= KAKYU ; shikyu_keitai++ )
							{
							  Kyufu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][SUM]
								 = Kyufu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][ZENHAN]
								    + Kyufu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][KOUHAN];
								
								Kyufu[seido][sotai_nendo][NENREI_SUM - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][SUM]
								 += Kyufu[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][taishou][shikyu_keitai][SUM];
                                                          
								if( taishou == KYOSHUTU )
								{
									Kokko[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][SUM]
									 = Kokko[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][ZENHAN]
									    + Kokko[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][KOUHAN];
									
									Kokko[seido][sotai_nendo][NENREI_SUM - NENREI_SUM][shinkyu][kubun][shikyu_keitai][SUM]
									 += Kokko[seido][sotai_nendo][nenrei - NENREI_SUM][shinkyu][kubun][shikyu_keitai][SUM];
								}
							}
						}
					}
				}
			}
			
			for( tokubetu_shurui = TOKUBETU_MENJO ; tokubetu_shurui <= TOKUBETU_20MAE ; tokubetu_shurui++ )
			{
				for( shikyu_keitai = KIHON ; shikyu_keitai <= KAKYU ; shikyu_keitai++ )
				{
					for( kikan = ZENHAN ; kikan <= KOUHAN ; kikan++ )
					{
						Tokubetukokko[sotai_nendo][nenrei - NENREI_SUM][tokubetu_shurui][SUM][kikan]
						 += Tokubetukokko[sotai_nendo][nenrei - NENREI_SUM][tokubetu_shurui][shikyu_keitai][kikan];
						Tokubetukokko[sotai_nendo][NENREI_SUM - NENREI_SUM][tokubetu_shurui][SUM][kikan]
						 += Tokubetukokko[sotai_nendo][nenrei - NENREI_SUM][tokubetu_shurui][shikyu_keitai][kikan];
						Tokubetukokko[sotai_nendo][NENREI_SUM - NENREI_SUM][tokubetu_shurui][shikyu_keitai][kikan]
						 += Tokubetukokko[sotai_nendo][nenrei - NENREI_SUM][tokubetu_shurui][shikyu_keitai][kikan];
					}
				}
			}
			
			for( tokubetu_shurui = TOKUBETU_MENJO ; tokubetu_shurui <= TOKUBETU_20MAE ; tokubetu_shurui++ )
			{
				for( shikyu_keitai = SUM ; shikyu_keitai <= KAKYU ; shikyu_keitai++ )
				{
					for( kikan = ZENHAN ; kikan <= KOUHAN ; kikan++ )
					{
						Tokubetukokko[sotai_nendo][nenrei - NENREI_SUM][SUM][shikyu_keitai][kikan]
						 += Tokubetukokko[sotai_nendo][nenrei - NENREI_SUM][tokubetu_shurui][shikyu_keitai][kikan];
						Tokubetukokko[sotai_nendo][NENREI_SUM - NENREI_SUM][SUM][shikyu_keitai][kikan]
						 += Tokubetukokko[sotai_nendo][nenrei - NENREI_SUM][tokubetu_shurui][shikyu_keitai][kikan];
					}
				}
			}
		}
		
		for( tokubetu_shurui = SUM ; tokubetu_shurui <= TOKUBETU_20MAE ; tokubetu_shurui++ )
		{
			for( shikyu_keitai = SUM ; shikyu_keitai <= KAKYU ; shikyu_keitai++ )
			{
				for( nenrei = UNDER_64 ; nenrei <= MAX_JUKYU ; nenrei++ )
				{
					Tokubetukokko[sotai_nendo][nenrei - NENREI_SUM][tokubetu_shurui][shikyu_keitai][SUM]
					 = Tokubetukokko[sotai_nendo][nenrei - NENREI_SUM][tokubetu_shurui][shikyu_keitai][ZENHAN]
					    + Tokubetukokko[sotai_nendo][nenrei - NENREI_SUM][tokubetu_shurui][shikyu_keitai][KOUHAN];
				}
				Tokubetukokko[sotai_nendo][NENREI_SUM - NENREI_SUM][tokubetu_shurui][shikyu_keitai][SUM]
				 = Tokubetukokko[sotai_nendo][NENREI_SUM - NENREI_SUM][tokubetu_shurui][shikyu_keitai][ZENHAN]
				    + Tokubetukokko[sotai_nendo][NENREI_SUM - NENREI_SUM][tokubetu_shurui][shikyu_keitai][KOUHAN];
			}
		}
	}
	
	for( nendo = SHONENDO + 1 ; nendo <= SUIKEISAISHUNENDO ; nendo++ )
	{
		sotai_nendo = nendo - SHONENDO;
		
		for( nenrei = UNDER_64 ; nenrei <= MAX_JUKYU ; nenrei++ )
		{
			for( kikan = SUM ; kikan <= KOUHAN ; kikan++ )
			{
				Tanka[sotai_nendo][nenrei - NENREI_SUM][kikan]
				 = Kyufu[SUM][sotai_nendo][nenrei - NENREI_SUM][SUM][SUM][KYOSHUTU][SUM][kikan]
				    / SanteiTaishou[SUM][sotai_nendo][SUM] / 12.;
				Tanka_K[sotai_nendo][nenrei - NENREI_SUM][kikan]
				 = Kyufu[SUM][sotai_nendo][nenrei - NENREI_SUM][SUM][SUM][KYOSHUTU][SUM][kikan]
				    / SanteiTaishou[SUM][sotai_nendo][SUM] / 12.;

				Tanka_Kokko[sotai_nendo][nenrei - NENREI_SUM][kikan]
				 = Kokko[SUM][sotai_nendo][nenrei - NENREI_SUM][SUM][SUM][SUM][kikan]
				    / SanteiTaishou[SUM][sotai_nendo][SUM] / 12;
			
				for( seido = SUM ; seido <= NORIN ; seido++ )
				{
					Kyoshutukin[seido][sotai_nendo][nenrei - NENREI_SUM][kikan]
					 = SanteiTaishou[seido][sotai_nendo][SUM] * Tanka[sotai_nendo][nenrei - NENREI_SUM][kikan] * 12;
                                        Kyoshutukin_Kokko[seido][sotai_nendo][nenrei - NENREI_SUM][kikan]
					 = SanteiTaishou[seido][sotai_nendo][SUM] * Tanka_Kokko[sotai_nendo][nenrei - NENREI_SUM][kikan] * 12;
                }
			}
		}

		for( nenrei = 63 ; nenrei <= MAX_JUKYU ; nenrei++ )
		{

			for( shikyu_keitai = SUM ; shikyu_keitai <= KAKYU ; shikyu_keitai++ )
			{
				if( SanteiTaishou[SUM][sotai_nendo][SUM] > 0. )
				{
					Tanka_Nendomatu[sotai_nendo][nenrei - NENREI_SUM][shikyu_keitai]
					 = Kyufu_Nendomatu[SUM][sotai_nendo][nenrei - NENREI_SUM][SUM][SUM][KYOSHUTU][shikyu_keitai][SUM] / SanteiTaishou[SUM][sotai_nendo][SUM] / 12.;
					Tanka_Kokko_Nendomatu[sotai_nendo][nenrei - NENREI_SUM][shikyu_keitai]
					 = Kokko_Nendomatu[SUM][sotai_nendo][nenrei - NENREI_SUM][SUM][SUM][shikyu_keitai][SUM] / SanteiTaishou[SUM][sotai_nendo][SUM] / 12.;
				}
				else
				{
					Tanka_Nendomatu[sotai_nendo][nenrei - NENREI_SUM][shikyu_keitai] = 0.;
					Tanka_Kokko_Nendomatu[sotai_nendo][nenrei - NENREI_SUM][shikyu_keitai] = 0.;
				}
			
				if( nendo == SAISHUNENDO )
				{
					if( SanteiTaishou[SUM][sotai_nendo][SUM] > 0. )
					{
						Tanka_Nendomatu_P[sotai_nendo][nenrei - NENREI_SUM][shikyu_keitai]
						 = Kyufu_Nendomatu_P[SUM][sotai_nendo][nenrei - NENREI_SUM][SUM][SUM][KYOSHUTU][shikyu_keitai][SUM] / SanteiTaishou[SUM][sotai_nendo][SUM] / 12.;
						Tanka_Kokko_Nendomatu_P[sotai_nendo][nenrei - NENREI_SUM][shikyu_keitai]
						 = Kokko_Nendomatu[SUM][sotai_nendo][nenrei - NENREI_SUM][SUM][SUM][shikyu_keitai][SUM]  / SanteiTaishou[SUM][sotai_nendo][SUM] / 12.;
					}
					else
					{
						Tanka_Nendomatu_P[sotai_nendo][nenrei - NENREI_SUM][shikyu_keitai] = 0.;
						Tanka_Kokko_Nendomatu_P[sotai_nendo][nenrei - NENREI_SUM][shikyu_keitai] = 0.;
					}
				}
				else
				{
					if( SanteiTaishou[SUM][sotai_nendo + 1][SUM] > 0. )
					{
						Tanka_Nendomatu_P[sotai_nendo][nenrei - NENREI_SUM][shikyu_keitai]
						 = Kyufu_Nendomatu_P[SUM][sotai_nendo][nenrei - NENREI_SUM][SUM][SUM][KYOSHUTU][shikyu_keitai][SUM] / SanteiTaishou[SUM][sotai_nendo + 1][SUM] / 12.;
						Tanka_Kokko_Nendomatu_P[sotai_nendo][nenrei - NENREI_SUM][shikyu_keitai]
						 = Kokko_Nendomatu_P[SUM][sotai_nendo][nenrei - NENREI_SUM][SUM][SUM][shikyu_keitai][SUM]  / SanteiTaishou[SUM][sotai_nendo + 1][SUM] / 12.;
					}
					else
					{
						Tanka_Nendomatu_P[sotai_nendo][nenrei - NENREI_SUM][shikyu_keitai] = 0.;
						Tanka_Kokko_Nendomatu_P[sotai_nendo][nenrei - NENREI_SUM][shikyu_keitai] = 0.;
					}
				}
				
				for( seido = KOUNEN ; seido <= NORIN ; seido++ )
				{
					Kyoshutukin_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][shikyu_keitai]
					 = SanteiTaishou[seido][sotai_nendo][SUM] * Tanka_Nendomatu[sotai_nendo][nenrei - NENREI_SUM][shikyu_keitai] * 12.;
					
					Kyoshutukin_Kokko_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][shikyu_keitai]
					 = SanteiTaishou[seido][sotai_nendo][SUM] * Tanka_Kokko_Nendomatu[sotai_nendo][nenrei - NENREI_SUM][shikyu_keitai] * 12.;
				
					if( nendo == SAISHUNENDO )
					{
						Kyoshutukin_Nendomatu_P[seido][sotai_nendo][nenrei - NENREI_SUM][shikyu_keitai]
						 = SanteiTaishou[seido][sotai_nendo][SUM] * Tanka_Nendomatu_P[sotai_nendo][nenrei - NENREI_SUM][shikyu_keitai] * 12.;
						Kyoshutukin_Kokko_Nendomatu_P[seido][sotai_nendo][nenrei - NENREI_SUM][shikyu_keitai]
						 = SanteiTaishou[seido][sotai_nendo][SUM] * Tanka_Kokko_Nendomatu_P[sotai_nendo][nenrei - NENREI_SUM][shikyu_keitai] * 12.;
					}
					else
					{
						Kyoshutukin_Nendomatu_P[seido][sotai_nendo][nenrei - NENREI_SUM][shikyu_keitai]
						 = SanteiTaishou[seido][sotai_nendo + 1][SUM] * Tanka_Nendomatu_P[sotai_nendo][nenrei - NENREI_SUM][shikyu_keitai] * 12.;
						Kyoshutukin_Kokko_Nendomatu_P[seido][sotai_nendo][nenrei - NENREI_SUM][shikyu_keitai]
						 = SanteiTaishou[seido][sotai_nendo + 1][SUM] * Tanka_Kokko_Nendomatu_P[sotai_nendo][nenrei - NENREI_SUM][shikyu_keitai] * 12.;
					}

					Kyoshutukin_Nendomatu[seido][sotai_nendo][NENREI_SUM - NENREI_SUM][shikyu_keitai]
					 += Kyoshutukin_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][shikyu_keitai];
					Kyoshutukin_Nendomatu_P[seido][sotai_nendo][NENREI_SUM - NENREI_SUM][shikyu_keitai]
					 += Kyoshutukin_Nendomatu_P[seido][sotai_nendo][nenrei - NENREI_SUM][shikyu_keitai];
				
					Kyoshutukin_Kokko_Nendomatu[seido][sotai_nendo][NENREI_SUM - NENREI_SUM][shikyu_keitai]
					 += Kyoshutukin_Kokko_Nendomatu[seido][sotai_nendo][nenrei - NENREI_SUM][shikyu_keitai];
					Kyoshutukin_Kokko_Nendomatu_P[seido][sotai_nendo][NENREI_SUM - NENREI_SUM][shikyu_keitai]
					 += Kyoshutukin_Kokko_Nendomatu_P[seido][sotai_nendo][nenrei - NENREI_SUM][shikyu_keitai];
				
				}
			}
		}
		
		for( seido = SUM ; seido <= NORIN ; seido++ )
		{
			for( nenrei = UNDER_64 ; nenrei <= MAX_JUKYU ; nenrei++ )
			{
				for( kikan = SUM ; kikan <= KOUHAN ; kikan++ )
				{
					Kyoshutukin[seido][sotai_nendo][NENREI_SUM - NENREI_SUM][kikan] += Kyoshutukin[seido][sotai_nendo][nenrei - NENREI_SUM][kikan];
					Kyoshutukin_Kokko[seido][sotai_nendo][NENREI_SUM - NENREI_SUM][kikan] += Kyoshutukin_Kokko[seido][sotai_nendo][nenrei - NENREI_SUM][kikan];
				}
			}
		}
		
		for( nenrei = UNDER_64 ; nenrei <= MAX_JUKYU ; nenrei++ )
		{
			for( kikan = SUM ; kikan <= KOUHAN ; kikan++ )
			{
				Tanka[sotai_nendo][NENREI_SUM - NENREI_SUM][kikan] += Tanka[sotai_nendo][nenrei - NENREI_SUM][kikan];
				Tanka_Kokko[sotai_nendo][NENREI_SUM - NENREI_SUM][kikan] += Tanka_Kokko[sotai_nendo][nenrei - NENREI_SUM][kikan];
			}
		}
	}
}
	
