/*************************************
*                                    *
*    外枠システム  simlichi.c        *
*  （第１号被保険者数の推計）        *
*                                    *
*************************************/

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "set.h"
#include "cntl.h"


void simlichisan(void) {
  double  TMP  ;
  double  TMQ  ;
  int     ii   ;
  int     XEND ;


    for ( nendo=STARTY+1; nendo<=KIJUNMAP; nendo++ ) {
      for ( nenrei=15; nenrei<=100; nenrei++ ) {


        ichigouip[nendo-STARTY][3][nenrei]
          = ichigouip[nendo-STARTY][2][nenrei] * ichiyuhaigr[nenrei] ;
        ichigouip[nendo-STARTY][4][nenrei]
          = ichigouip[nendo-STARTY][2][nenrei] * ( 1.0 - ichiyuhaigr[nenrei] ) ;
        ichigouni[nendo-STARTY][3][nenrei]
          = ichigouni[nendo-STARTY][2][nenrei] * ichiyuhaigr[nenrei] ;
        ichigouni[nendo-STARTY][4][nenrei]
          = ichigouni[nendo-STARTY][2][nenrei] * ( 1.0 - ichiyuhaigr[nenrei] ) ;

        for ( sei=0; sei<=4; sei++ ) {
          ichigou[nendo-STARTY][sei][nenrei] = 
            ichigouip[nendo-STARTY][sei][nenrei] + ichigouni[nendo-STARTY][sei][nenrei] ;
        }


        for ( sei=0; sei<=4; sei++ ) {
           mika_soto1[nendo-STARTY][sei][nenrei]
             = jinko_m[nendo-STARTY][sei][nenrei] - ichigou[nendo-STARTY][sei][nenrei]
                 - nigou[nendo-STARTY][sei][nenrei] - sangou[nendo-STARTY][sei][nenrei] - partnin[nendo-STARTY][sei][nenrei][0][0]; 
           mika_soto2[nendo-STARTY][sei][nenrei]
             = max( 0.0 , mika_soto1[nendo-STARTY][sei][nenrei] ) ;
           mika_soto3[nendo-STARTY][sei][nenrei]
             = mika_soto1[nendo-STARTY][sei][nenrei];
			if ( MIKA == 1){
               r_mika_soto[nendo-STARTY][sei][nenrei]
                = mika_soto3[nendo-STARTY][sei][nenrei] / jinko_m[nendo-STARTY][sei][nenrei] ;
            }
            
        }

      }
    }


    for ( sei=1; sei<=2; sei++ ) {
      for ( nenrei=20; nenrei<=69; nenrei++ ) {
        if ( nenrei<=59 ) { 
          r_ichigouni[KIJUNMAP-STARTY][sei][nenrei]
            = ichigouni[KIJUNMAP-STARTY][sei][nenrei] / jinko_m[KIJUNMAP-STARTY][sei][nenrei] ;
        }
        else { 
          r_ichigouni[KIJUNMAP-STARTY][sei][nenrei] = ichigouni[KIJUNMAP-STARTY][sei][nenrei]
             / ( jinko_m[KIJUNMAP-STARTY][sei][nenrei] - nigou[KIJUNMAP-STARTY][sei][nenrei] - partnin[KIJUNMAP-STARTY][sei][nenrei][0][0]) ;
        }
      }
    }
    for ( nendo=KIJUNMAP+1; nendo<=KE; nendo++ ) {
      for ( nenrei=20; nenrei<=69; nenrei++ ) {

        for ( sei=1; sei<=2; sei++ ) {
          if ( nenrei<=59 ) {
            ichigouni[nendo-STARTY][sei][nenrei]
              = jinko_m[nendo-STARTY][sei][nenrei] * r_ichigouni[KIJUNMAP-STARTY][sei][nenrei] ;
          }
          else {
            ichigouni[nendo-STARTY][sei][nenrei]
              = ( jinko_m[nendo-STARTY][sei][nenrei] - nigou[nendo-STARTY][sei][nenrei]- partnin[nendo-STARTY][sei][nenrei][0][0] )
                  * r_ichigouni[KIJUNMAP-STARTY][sei][nenrei] ;
          }
        }
        ichigouni[nendo-STARTY][3][nenrei]
          = ichigouni[nendo-STARTY][2][nenrei] * yuhaigr_m[nendo-STARTY][nenrei] ;
        ichigouni[nendo-STARTY][4][nenrei]
          = ichigouni[nendo-STARTY][2][nenrei] * ( 1.0 - yuhaigr_m[nendo-STARTY][nenrei] ) ;
        /*  男女計  */
        ichigouni[nendo-STARTY][0][nenrei]
          = ichigouni[nendo-STARTY][1][nenrei] + ichigouni[nendo-STARTY][2][nenrei] ;

      }
    }


  for ( nendo=KIJUNMAP+1; nendo<=KE; nendo++ ) {
    for ( nenrei=20; nenrei<=64; nenrei++ ) {

      for ( sei=1; sei<=2; sei++ ) {
        if ( MIKA ==1 ) {
            if ( nendo >= 2035 ) {
         	 r_mika_soto[nendo-STARTY][sei][nenrei] = 0.0 ;
        	}
        	else if ( nenrei<=59 ) {

         	 r_mika_soto[nendo-STARTY][sei][nenrei] 
           		= r_mika_soto[nendo-1-STARTY][sei][nenrei-1] 
              		* (double)( 2035 - nendo ) / (double)( 2035 - nendo + 1 ) ;
        	 r_mika_soto[KIJUNMAP+1-STARTY][sei][20] 
           		= 0.0 ;
        	}
        	else {
          	r_mika_soto[nendo-STARTY][sei][nenrei] = r_mika_soto[nendo-STARTY][sei][59] ;
        	}
        }

        

         mika_soto1[nendo-STARTY][sei][nenrei] 
           = r_mika_soto[nendo-STARTY][sei][nenrei] * jinko_m[nendo-STARTY][sei][nenrei] ;
       
       

      }

      mika_soto1[nendo-STARTY][3][nenrei] 
        = mika_soto1[nendo-STARTY][2][nenrei] * yuhaigr_m[nendo-STARTY][nenrei] ;
      mika_soto1[nendo-STARTY][4][nenrei] 
        = mika_soto1[nendo-STARTY][2][nenrei] * ( 1.0 - yuhaigr_m[nendo-STARTY][nenrei] ) ;
      /*  男女計  */
      mika_soto1[nendo-STARTY][0][nenrei] 
        = mika_soto1[nendo-STARTY][1][nenrei] + mika_soto1[nendo-STARTY][2][nenrei] ;

    }
  }


  for ( nendo=KIJUNMAP+1; nendo<=KE; nendo++ ) {
    XEND = xend[8][nendo-STARTY] ; 
    if ( XEND < 60 ) { XEND = 60; }
    for ( nenrei=20; nenrei<=XEND-1; nenrei++ ) {

      if ( kounen[KIJUNMAP-STARTY][3][nenrei] + partnin[KIJUNMAP-STARTY][3][nenrei][0][0] > 0.0 ) {
        kounen3[nendo-STARTY][1][nenrei] = ( kounen[nendo-STARTY][3][nenrei] + partnin[nendo-STARTY][3][nenrei][0][0] )
          * kounen3[KIJUNMAP-STARTY][1][nenrei] / (kounen[KIJUNMAP-STARTY][3][nenrei] + partnin[KIJUNMAP-STARTY][3][nenrei][0][0]);
      }
      else { 
        kounen3[nendo-STARTY][1][nenrei]
          = ( kounen[nendo-STARTY][3][nenrei-1] + kounen[nendo-STARTY][3][nenrei+1] + partnin[nendo-STARTY][3][nenrei-1][0][0] + partnin[nendo-STARTY][3][nenrei+1][0][0] ) 
            * kounen3[KIJUNMAP-STARTY][1][nenrei]
            / ( kounen[KIJUNMAP-STARTY][3][nenrei-1] + kounen[KIJUNMAP-STARTY][3][nenrei+1] + partnin[KIJUNMAP-STARTY][3][nenrei-1][0][0] + partnin[KIJUNMAP-STARTY][3][nenrei+1][0][0]) ;
      }
      kou3syu3[nendo-STARTY][1][nenrei] = 0.0 ; 
      kou12syu3[nendo-STARTY][1][nenrei] = kounen3[nendo-STARTY][1][nenrei] ;
      qkou12syu3[nendo-STARTY][1][nenrei] = kounen3[nendo-STARTY][1][nenrei] ;

      for ( seido=4; seido<=7; seido++ ) {
        if ( kounen3[KIJUNMAP-STARTY][1][nenrei] > 0.0 ) {
          kyosai3[seido][nendo-STARTY][1][nenrei] = kounen3[nendo-STARTY][1][nenrei]
            * kyosai3[seido][KIJUNMAP-STARTY][1][nenrei] / kounen3[KIJUNMAP-STARTY][1][nenrei] ;
        }
        else { 
          kyosai3[seido][nendo-STARTY][1][nenrei] = 0.0 ; 
        }
        qkou12syu3[nendo-STARTY][1][nenrei] -= kyosai3[seido][nendo-STARTY][1][nenrei] ;
      }
      qkounen3[nendo-STARTY][1][nenrei] = qkou12syu3[nendo-STARTY][1][nenrei] ;

      for ( seido=1; seido<=3; seido++ ) {
        if ( kyosai[seido][KIJUNMAP-STARTY][3][nenrei] > 0.0 ) {
          kyosai3[seido][nendo-STARTY][1][nenrei] = kyosai[seido][nendo-STARTY][3][nenrei]
            * kyosai3[seido][KIJUNMAP-STARTY][1][nenrei] / kyosai[seido][KIJUNMAP-STARTY][3][nenrei] ;
        }
        else { 
          kyosai3[seido][nendo-STARTY][1][nenrei]
            = ( kyosai[seido][nendo-STARTY][3][nenrei-1] + kyosai[seido][nendo-STARTY][3][nenrei+1] )
              * kyosai3[seido][KIJUNMAP-STARTY][1][nenrei]
              / ( kyosai[seido][KIJUNMAP-STARTY][3][nenrei-1] + kyosai[seido][KIJUNMAP-STARTY][3][nenrei+1] ) ;
        }
      }

      sangou[nendo-STARTY][1][nenrei] = kounen3[nendo-STARTY][1][nenrei] ;
      for ( seido=1; seido<=3; seido++ ) {
        sangou[nendo-STARTY][1][nenrei] += kyosai3[seido][nendo-STARTY][1][nenrei] ;
      }

    }
  }

  for ( nendo=KIJUNMAP+1; nendo<=KE; nendo++ ) {
    XEND = xend[8][nendo-STARTY] ; 
    if ( XEND < 60 ) { XEND = 60; }
    for ( nenrei=20; nenrei<=XEND-1; nenrei++ ) {

      TMP = jinko_m[KIJUNMAP-STARTY][3][nenrei] - nigou[KIJUNMAP-STARTY][3][nenrei] -  partnin[KIJUNMAP-STARTY][3][nenrei][0][0] ;
      TMQ = jinko_m[nendo-STARTY][3][nenrei] - nigou[nendo-STARTY][3][nenrei] -  partnin[nendo-STARTY][3][nenrei][0][0];
      if (( TMP > 0.0 ) && ( TMQ > 0.0 )) {

		if ( MODESAN == 1 ) {
          sangou[nendo-STARTY][3][nenrei] = TMQ * sangou[KIJUNMAP-STARTY][3][nenrei] / TMP 
            * ( (nigou[nendo-STARTY][1][nenrei]+ partnin[nendo-STARTY][1][nenrei][0][0]) / jinko_m[nendo-STARTY][1][nenrei] )
            / ( (nigou[KIJUNMAP-STARTY][1][nenrei]+ partnin[KIJUNMAP-STARTY][1][nenrei][0][0]) / jinko_m[KIJUNMAP-STARTY][1][nenrei] ) ;
        }
      }
      else { 
        sangou[nendo-STARTY][3][nenrei] = 0.0 ;
      }
      sangou[nendo-STARTY][4][nenrei] = 0.0 ; 
      sangou[nendo-STARTY][2][nenrei] = sangou[nendo-STARTY][3][nenrei] ;

      kounen3[nendo-STARTY][3][nenrei] = sangou[nendo-STARTY][3][nenrei]
        * (kounen[nendo-STARTY][1][nenrei]+ partnin[nendo-STARTY][1][nenrei][0][0] )/ (nigou[nendo-STARTY][1][nenrei]+ partnin[nendo-STARTY][1][nenrei][0][0] ); 
      kounen3[nendo-STARTY][4][nenrei] = 0.0 ;
      kounen3[nendo-STARTY][2][nenrei] = kounen3[nendo-STARTY][3][nenrei] ;
      kou3syu3[nendo-STARTY][3][nenrei] = sangou[nendo-STARTY][3][nenrei]
        * kou3syu[nendo-STARTY][1][nenrei] / (nigou[nendo-STARTY][1][nenrei]+ partnin[nendo-STARTY][1][nenrei][0][0]) ;
      kou3syu3[nendo-STARTY][4][nenrei] = 0.0 ;
      kou3syu3[nendo-STARTY][2][nenrei] = kou3syu3[nendo-STARTY][3][nenrei] ;
      for ( sei=2; sei<=4; sei++ ) { 
        kou12syu3[nendo-STARTY][sei][nenrei]
          = kounen3[nendo-STARTY][sei][nenrei] - kou3syu3[nendo-STARTY][sei][nenrei] ;
      }
      qkou12syu3[nendo-STARTY][3][nenrei] = kou12syu3[nendo-STARTY][3][nenrei] ;
      qkounen3[nendo-STARTY][3][nenrei] = kounen3[nendo-STARTY][3][nenrei] ;
      for ( seido=4; seido<=7; seido++ ) {
        if ( kou12syu3[KIJUNMAP-STARTY][3][nenrei] > 0.0 ) {
          kyosai3[seido][nendo-STARTY][3][nenrei] = kou12syu3[nendo-STARTY][3][nenrei]
            * kyosai3[seido][KIJUNMAP-STARTY][3][nenrei] / kou12syu3[KIJUNMAP-STARTY][3][nenrei] ;
        }
        else { 
          kyosai3[seido][nendo-STARTY][3][nenrei] = 0.0 ;
        }
        kyosai3[seido][nendo-STARTY][4][nenrei] = 0.0 ;
        kyosai3[seido][nendo-STARTY][2][nenrei] = kyosai3[seido][nendo-STARTY][3][nenrei] ;
        qkou12syu3[nendo-STARTY][3][nenrei] -= kyosai3[seido][nendo-STARTY][3][nenrei] ;
        qkounen3[nendo-STARTY][3][nenrei] -= kyosai3[seido][nendo-STARTY][3][nenrei] ;
      }
      qkou12syu3[nendo-STARTY][4][nenrei] = 0.0 ;
      qkou12syu3[nendo-STARTY][2][nenrei] = qkou12syu3[nendo-STARTY][3][nenrei] ;
      qkounen3[nendo-STARTY][4][nenrei] = 0.0 ;
      qkounen3[nendo-STARTY][2][nenrei] = qkounen3[nendo-STARTY][3][nenrei] ;

      for ( seido=1; seido<=3; seido++ ) {
        kyosai3[seido][nendo-STARTY][3][nenrei] = sangou[nendo-STARTY][3][nenrei]
          * kyosai[seido][nendo-STARTY][1][nenrei] / (nigou[nendo-STARTY][1][nenrei] +  partnin[nendo-STARTY][1][nenrei][0][0] );
        kyosai3[seido][nendo-STARTY][4][nenrei] = 0.0 ;
        kyosai3[seido][nendo-STARTY][2][nenrei] = kyosai3[seido][nendo-STARTY][3][nenrei] ;
      }

	   if ( MODE >= 4) {
		 if ( nendo >= 2026 ) {
		    if ( nenrei >=45 && nenrei<=49 ) {
	        	 for ( sei=1; sei<=3; sei++){
				 	qkou12syu3[nendo-STARTY][sei][nenrei]=qkou12syu3[nendo-STARTY][sei][nenrei]*(1.0+(XEND-60)/5.0*0.004);
	    	     	qkounen3[nendo-STARTY][sei][nenrei]=qkounen3[nendo-STARTY][sei][nenrei]*(1.0+(XEND-60)/5.0*0.004);
	        	 	kou3syu3[nendo-STARTY][sei][nenrei]=kou3syu3[nendo-STARTY][sei][nenrei]*(1.0+(XEND-60)/5.0*0.004);
	         	 	kou12syu3[nendo-STARTY][sei][nenrei]=kou12syu3[nendo-STARTY][sei][nenrei]*(1.0+(XEND-60)/5.0*0.004);
	        	 	kounen3[nendo-STARTY][sei][nenrei]=kounen3[nendo-STARTY][sei][nenrei]*(1.0+(XEND-60)/5.0*0.004);
	      			for ( seido=1; seido<=7; seido++ ) {
    	   				 kyosai3[seido][nendo-STARTY][sei][nenrei]=kyosai3[seido][nendo-STARTY][sei][nenrei]*(1.0+(XEND-60)/5.0*0.004);
	      			}
				 	sangou[nendo-STARTY][sei][nenrei]=sangou[nendo-STARTY][sei][nenrei]*(1.0+(XEND-60)/5.0*0.004);
				}
			}
			if ( nenrei >=50 && nenrei<=54 ) {
	        	 for ( sei=1; sei<=3; sei++){
				 	qkou12syu3[nendo-STARTY][sei][nenrei]=qkou12syu3[nendo-STARTY][sei][nenrei]*(1.0+(XEND-60)/5.0*0.009);
	    	     	qkounen3[nendo-STARTY][sei][nenrei]=qkounen3[nendo-STARTY][sei][nenrei]*(1.0+(XEND-60)/5.0*0.009);
	        	 	kou3syu3[nendo-STARTY][sei][nenrei]=kou3syu3[nendo-STARTY][sei][nenrei]*(1.0+(XEND-60)/5.0*0.009);
	         	 	kou12syu3[nendo-STARTY][sei][nenrei]=kou12syu3[nendo-STARTY][sei][nenrei]*(1.0+(XEND-60)/5.0*0.009);
	        	 	kounen3[nendo-STARTY][sei][nenrei]=kounen3[nendo-STARTY][sei][nenrei]*(1.0+(XEND-60)/5.0*0.009);
	      			for ( seido=1; seido<=7; seido++ ) {
    	   				 kyosai3[seido][nendo-STARTY][sei][nenrei]=kyosai3[seido][nendo-STARTY][sei][nenrei]*(1.0+(XEND-60)/5.0*0.009);
	      			}
				 	sangou[nendo-STARTY][sei][nenrei]=sangou[nendo-STARTY][sei][nenrei]*(1.0+(XEND-60)/5.0*0.009);
				}
			}
			if ( nenrei >=55 && nenrei<=59 ) {
	        	 for ( sei=1; sei<=3; sei++){
				 	qkou12syu3[nendo-STARTY][sei][nenrei]=qkou12syu3[nendo-STARTY][sei][nenrei]*(1.0+(XEND-60)/5.0*0.058);
	    	     	qkounen3[nendo-STARTY][sei][nenrei]=qkounen3[nendo-STARTY][sei][nenrei]*(1.0+(XEND-60)/5.0*0.058);
	        	 	kou3syu3[nendo-STARTY][sei][nenrei]=kou3syu3[nendo-STARTY][sei][nenrei]*(1.0+(XEND-60)/5.0*0.058);
	         	 	kou12syu3[nendo-STARTY][sei][nenrei]=kou12syu3[nendo-STARTY][sei][nenrei]*(1.0+(XEND-60)/5.0*0.058);
	        	 	kounen3[nendo-STARTY][sei][nenrei]=kounen3[nendo-STARTY][sei][nenrei]*(1.0+(XEND-60)/5.0*0.058);
	      			for ( seido=1; seido<=7; seido++ ) {
    	   				 kyosai3[seido][nendo-STARTY][sei][nenrei]=kyosai3[seido][nendo-STARTY][sei][nenrei]*(1.0+(XEND-60)/5.0*0.058);
	      			}
				 	sangou[nendo-STARTY][sei][nenrei]=sangou[nendo-STARTY][sei][nenrei]*(1.0+(XEND-60)/5.0*0.058);
				}
			}
		}
	  }

      /*  男女計  */
      qkou12syu3[nendo-STARTY][0][nenrei]
        = qkou12syu3[nendo-STARTY][1][nenrei] + qkou12syu3[nendo-STARTY][2][nenrei] ;
      qkounen3[nendo-STARTY][0][nenrei]
        = qkounen3[nendo-STARTY][1][nenrei] + qkounen3[nendo-STARTY][2][nenrei] ;
      kou3syu3[nendo-STARTY][0][nenrei]
        = kou3syu3[nendo-STARTY][1][nenrei] + kou3syu3[nendo-STARTY][2][nenrei] ;
      kou12syu3[nendo-STARTY][0][nenrei]
        = kou12syu3[nendo-STARTY][1][nenrei] + kou12syu3[nendo-STARTY][2][nenrei] ;
      kounen3[nendo-STARTY][0][nenrei]
        = kounen3[nendo-STARTY][1][nenrei] + kounen3[nendo-STARTY][2][nenrei] ;
      for ( seido=1; seido<=7; seido++ ) {
        kyosai3[seido][nendo-STARTY][0][nenrei]
          = kyosai3[seido][nendo-STARTY][1][nenrei] + kyosai3[seido][nendo-STARTY][2][nenrei] ;
      }
      sangou[nendo-STARTY][0][nenrei]
        = sangou[nendo-STARTY][1][nenrei] + sangou[nendo-STARTY][2][nenrei] ;

    }
  }


  for ( nendo=KIJUNMAP+1; nendo<=KE; nendo++ ) {
    XEND = xend[8][nendo-STARTY] ; 
    if ( XEND < 60 ) { XEND = 60; }

    for ( nenrei=20; nenrei<=XEND-1; nenrei++ ) {
      for ( sei=1; sei<=4; sei++ ) {
        TMP = jinko_m[nendo-STARTY][sei][nenrei] - mika_soto1[nendo-STARTY][sei][nenrei]
                - nigou[nendo-STARTY][sei][nenrei] - sangou[nendo-STARTY][sei][nenrei] -  partnin[nendo-STARTY][sei][nenrei][0][0]
                - ichigouni[nendo-STARTY][sei][nenrei] ;
        if ( TMP < 0.0 ) { 
            fprintf(stderr, "%d年度の性%d年齢%dの１号一般がマイナス!\n", nendo, sei, nenrei );
            printf("%d年度の性%d年齢%dの１号一般がマイナス!\n", nendo, sei, nenrei );
            fprintf(stderr, "ichigouip[nendo-STARTY][sei][nenrei]=%11.9e\n", ichigouip[nendo-STARTY][sei][nenrei]);
            printf("ichigouip[nendo-STARTY][sei][nenrei]=%11.9e\n", ichigouip[nendo-STARTY][sei][nenrei]);
            ichigouip[nendo-STARTY][sei][nenrei] = 0.0 ;
        }
        else {
          ichigouip[nendo-STARTY][sei][nenrei] = TMP ;
        }
      }
      /*  女性計  */
      ichigouip[nendo-STARTY][2][nenrei]
        = ichigouip[nendo-STARTY][3][nenrei] + ichigouip[nendo-STARTY][4][nenrei] ;
      /*  男女計  */
      ichigouip[nendo-STARTY][0][nenrei]
        = ichigouip[nendo-STARTY][1][nenrei] + ichigouip[nendo-STARTY][2][nenrei] ;
    }

    for ( sei=0; sei<=4; sei++ ) {
      for ( nenrei=20; nenrei<=69; nenrei++ ) {
        ichigou[nendo-STARTY][sei][nenrei]
          = ichigouip[nendo-STARTY][sei][nenrei] + ichigouni[nendo-STARTY][sei][nenrei] ;
      }
    }

  }
  for ( nendo=STARTY+1; nendo<=KE; nendo++ ) {
    XEND = xend[8][nendo-STARTY] ; 
    if ( XEND < 60 ) { XEND = 60; }
    for ( sei=0; sei<=4; sei++ ) {
      for ( nenrei=0; nenrei<=19; nenrei++ ) {
        mika_soto1[nendo-STARTY][sei][nenrei] = 0.0 ;
      }
      for ( nenrei=XEND; nenrei<=100; nenrei++ ) {
        mika_soto1[nendo-STARTY][sei][nenrei] = 0.0 ;
      }
    }
  }

  XEND = xend[8][KIJUNMAP-STARTY] ; 
  if ( XEND < 60 ) { XEND = 60; }
  for ( sei=0; sei<=4; sei++ ) {
    for ( nenrei=XEND; nenrei<=100; nenrei++ ) {
      sangou[KIJUNMAP-STARTY][sei][nenrei] = 0.0 ;
      kounen3[KIJUNMAP-STARTY][sei][nenrei] = 0.0 ;
      qkounen3[KIJUNMAP-STARTY][sei][nenrei] = 0.0 ;
      kou12syu3[KIJUNMAP-STARTY][sei][nenrei] = 0.0 ;
      qkou12syu3[KIJUNMAP-STARTY][sei][nenrei] = 0.0 ;
      kou3syu3[KIJUNMAP-STARTY][sei][nenrei] = 0.0 ;
      for ( ii=1; ii<=7; ii++ ) {
        kyosai3[ii][KIJUNMAP-STARTY][sei][nenrei] = 0.0 ;
      }
    }
  }



 
}

