In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

forked from: forked from: 富士山

SRTMのデータをもとに富士山をトレースしてみた。
* 実際にはこんな急峻な斜面ではなく、かなりデフォルメしている。
* 
* この辺の情報が参考になるよ。
* http://www.yamareco.com/weblog/archives/2007/03/gps_2.html
* 
* 下山が完了すると、
* Debug camera つかってるのでカーソルキーでカメラが動くよ。
*

MountainView_6_cardviewer.as
cardviewer
/**
 * Copyright kappaLab ( http://wonderfl.net/user/kappaLab )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/nFby
 */

// forked from kappaLab's forked from: 富士山
// forked from kappaLab's 富士山
/*
 * SRTMのデータをもとに富士山をトレースしてみた。
 * 実際にはこんな急峻な斜面ではなく、かなりデフォルメしている。
 * 
 * この辺の情報が参考になるよ。
 * http://www.yamareco.com/weblog/archives/2007/03/gps_2.html
 * 
 * 下山が完了すると、
 * Debug camera つかってるのでカーソルキーでカメラが動くよ。
 *
 */ 
 //MountainView_6_cardviewer.as
//cardviewer

package  
{
    import caurina.transitions.Tweener;
    import flash.display.Loader;
    import flash.display.LoaderInfo;
    import flash.display.Shape;
    import flash.display.Sprite;
    import flash.display.StageQuality
    import flash.events.Event;
    import flash.events.IOErrorEvent;
    import flash.events.KeyboardEvent;
    import flash.events.MouseEvent;
    import flash.media.Camera;
    import flash.net.URLRequest;
    import flash.system.LoaderContext;
    import flash.ui.Keyboard;
    import org.papervision3d.cameras.Camera3D;
    import org.papervision3d.cameras.CameraType;
    import org.papervision3d.cameras.DebugCamera3D;
    import org.papervision3d.core.geom.Lines3D;
    import org.papervision3d.core.geom.renderables.Vertex3D;
    import org.papervision3d.core.proto.MaterialObject3D;
    import org.papervision3d.events.InteractiveScene3DEvent;
    import org.papervision3d.events.RendererEvent
    import org.papervision3d.materials.BitmapAssetMaterial;
    import org.papervision3d.materials.MovieAssetMaterial;
    import org.papervision3d.materials.MovieMaterial;
    import org.papervision3d.materials.special.LineMaterial;
    import org.papervision3d.materials.special.VectorShapeMaterial;
    import org.papervision3d.materials.WireframeMaterial;
    import org.papervision3d.objects.DisplayObject3D;
    import org.papervision3d.objects.primitives.Arrow;
    import org.papervision3d.objects.primitives.Cone;
    import org.papervision3d.objects.primitives.PaperPlane;
    import org.papervision3d.objects.primitives.Plane;
    import org.papervision3d.objects.primitives.Sphere;
    import org.papervision3d.objects.special.commands.LineTo;
    import org.papervision3d.objects.special.Graphics3D;
    import org.papervision3d.objects.special.VectorShape3D;
    import org.papervision3d.view.BasicView;
    import org.papervision3d.view.stats.StatsView;
    public class MountainView extends BasicView
    {
        private const WIDTH:Number = 500
        private const SEGMENT:int = 60
        private var _map:Plane;
        private var _cards:Vector.<Plane>;
        private var _points:Vector.<DisplayObject3D>;
        private var _container:DisplayObject3D;
        private var _shape:VectorShape3D;
        private var _isSpaceKeyDown:Boolean;
        private var _arrows:Vector.<DisplayObject3D>;
        
        public function MountainView() 
        {
            super(500, 500, true, true, CameraType.DEBUG);
            
            stage.quality = StageQuality.LOW;
            stage.scaleMode = "noScale"
            _cards = new Vector.<Plane>();
            _points = new Vector.<DisplayObject3D>();
            _arrows = new Vector.<DisplayObject3D>();
            _isSpaceKeyDown = false;
            stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeydown);
            stage.addEventListener(KeyboardEvent.KEY_UP, onKeyup);
            
            viewport.interactive = true;
            viewport.buttonMode = true;
            
            var loader:Loader = new Loader();
            loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaded);
            loader.load(new URLRequest("http://assets.wonderfl.net/images/related_images/4/41/4113/4113aafc8c36436008f3561bc75e7ae808d6901e")
            ,new LoaderContext(true));
        }
        private function onLoaded(e:Event):void 
        {
            _container = scene.addChild(new DisplayObject3D());
            var materal:MaterialObject3D = new MovieMaterial(LoaderInfo(e.target).content);
            //BitmapAssetMaterial(materal).lineAlpha = 1
            //BitmapAssetMaterial(materal).lineColor = 0xFF0000
            //BitmapAssetMaterial(materal).lineThickness = 1
            _map = scene.addChild(new Plane(materal, WIDTH, WIDTH, SEGMENT)) as Plane;

            _map.moveDown(60)
            _map.rotationX = 90;
            
            _camera.zoom = 190; 
            var i:int = 0;
            for each(var v:Vertex3D in _map.geometry.vertices) 
            {
                var h:Number = DATA_FROM_SRTM[i];
                //h = (h > 0)?h:0;
                v.z = h * -.015;
                v.extra = {height:h}
                i++
            }
            
            var route:Array = [
                [10,30],
                [12,32],
                [14,34],
                [16,36],
                [18,34],
                [20,32],
                [22,32],
                [24,32],
                [25,30],
                [26,29],
                [27,28],
                [27,29],
                [27,30],
                [28,31],
                [29,31],
                [30,31],
                [31,32],
                [32,31],
                [33,30],
                [34,31],
                [35,31],
                [36,30],
                [36,29],
                [35,27],
                [36,28],
                [38,29],
                [40,30],
                [45,33]
            ];

            var lines:Lines3D = new Lines3D(new LineMaterial(0x0000FF))
            _map.addChild(lines)    
            
            var old:Vertex3D = _map.geometry.vertices[xy2index(route[0][0],route[0][1])];
            
            var len:int = route.length;
            for (i = 0; i < len; i++) 
            {
                v = _map.geometry.vertices[xy2index(route[i][0],route[i][1])];
                var p:DisplayObject3D = _map.addChild(new DisplayObject3D());
                _points.push(p);
                p.x = v.x
                p.y = v.y
                p.z = v.z - 10;
                
                
                var sh:Sprite = new Sprite()
                sh.graphics.beginFill(0 << 16 | i*(0xCC/len)+0x33 << 8 | 0)
                sh.graphics.lineStyle(1)
                sh.graphics.drawRect(0, 0, 10, 10)
                sh.alpha = .5;
                var cm:MaterialObject3D = new MovieMaterial(new CardMC(i.toString()),true);
                cm.interactive = true;
                cm.doubleSided = true
                var c:Plane = _map.addChild(new Plane(cm, 10, 10)) as Plane;
                _cards.push(c);
                c.copyPosition(p)
                c.extra = { index:i, x:v.x, y:v.y, z:v.z, height:v.extra.height };
                
                sh.graphics.clear()
                sh.graphics.beginFill(i * (0xAA / len) + 0x44 << 16 | 0 << 8 | 0);
                sh.graphics.drawRect(0, 0, 10, 10)
                cm = new MovieMaterial(sh);
                var ar:DisplayObject3D = _map.addChild(new Arrow(cm));
                _arrows.push(ar);
                ar.scale = .005;
                ar.copyPosition(p)
                lines.addNewLine(2,old.x, old.y, old.z, v.x, v.y, v.z);
                
                old = v;
                
            }

            len = _arrows.length-1
            for (i=0; i < len; i++) 
            {
                c = _cards[i];
                p = _points[i];
                var next:DisplayObject3D = _points[i + 1];

                p.lookAt(next);
                _arrows[i].lookAt(next);
                _arrows[i].moveBackward(3)
                c.rotationX=-90
                c.localRotationY = Math.atan2(next.y - p.y, next.x - p.x) / Math.PI * 180 - 90;
            }
            
            stage.addChild(new CardManager(_cards));
            
            startRendering();
            onRenderTick();
            
            camera.extra = { cardIndex: 0 };
            goNextPoint()

        }
        
        
        private function goNextPoint():void
        {
            var i:int = camera.extra.cardIndex
            var ponit:DisplayObject3D = _points[i];
            var arrow:DisplayObject3D = _arrows[i];
            camera.target = ponit
            
            Tweener.addTween(camera, {time:2, transition:"linear", 
                x:_arrows[i].sceneX, y:_arrows[i].sceneY,  z:_arrows[i].sceneZ,
                zoom:60,
                onComplete:function():void {
                    camera.target = null;
                    if (_points.length > ++camera.extra.cardIndex) goNextPoint()
                    else camera.target = _points[int(_points.length*.5)]
                }
            } );

        }
        
        private function onKeyup(e:KeyboardEvent):void 
        {
            if (e.keyCode == Keyboard.SPACE) _isSpaceKeyDown = false;
        }
        private function onKeydown(e:KeyboardEvent):void 
        {
            if (e.keyCode == Keyboard.SPACE) _isSpaceKeyDown = true;
        }
        
        private function xy2index(x:int,y:int):int
        {
            return x + (SEGMENT + 1) * y;
        }
        
        
        override protected function onRenderTick(event:Event = null):void 
        {
            super.onRenderTick(event);
            
            if(_isSpaceKeyDown){
                _map.rotationY = -(mouseX - stage.stageWidth * .5) * .4;
                _map.rotationX = 90 + (mouseY - stage.height * .5) * .6;
            }

        }
    }
}
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormatAlign;
import org.papervision3d.events.InteractiveScene3DEvent;
import org.papervision3d.objects.DisplayObject3D;
import org.papervision3d.objects.primitives.Plane;
import org.papervision3d.view.BasicView
class CardManager extends Sprite
{
    private var _cards:Vector.<Plane>;
    private var _tf:TextField
    function CardManager(cards:Vector.<Plane>)
    {
        y= 300
        _cards = cards;
        var i:int=0
        for each(var p:Plane in _cards) 
        {
            p.addEventListener(InteractiveScene3DEvent.OBJECT_RELEASE, onObjRelease)
        }
        _tf = addChild(new TextField()) as TextField;
        _tf.defaultTextFormat = new TextFormat("Verdana", 12,0,true);
        _tf.text = "Card Manager"
    }
    private function onObjRelease(e:InteractiveScene3DEvent):void 
    {
        var obj:DisplayObject3D = e.target as DisplayObject3D;
        if (obj.scale == 2) { obj.scale = 1; return; }
        
        for each(var p:Plane in _cards) 
        {
            p.scale = 1;
        }
        obj.scale = 2;
        _tf.text = "Card Manager \n"
                 + "index : " + obj.extra.index + "\n"
                 + "heigh : " + obj.extra.height
    }

}

class CardMC extends MovieClip
{
    function CardMC(name:String="1",color:uint=0x00FF00)
    {
        x = y = 100
        graphics.beginFill(color)
        graphics.lineStyle(1)
        graphics.drawRect(0, 0, 25, 25)
        alpha = .3;
        var tf:TextField = addChild(new TextField()) as TextField
        var format:TextFormat = new TextFormat("Arial", 20)
        format.align = TextFormatAlign.CENTER
        format.bold = "bold"
        tf.defaultTextFormat = format;
        tf.width = tf.height = 25
        tf.text = name
        
        
    }
}
internal const DATA_FROM_SRTM:Array = [1003,1035,1141,1067,908,839,802,818,1051,1145,1246,1374,1493,1496,1390,1355,1267,1227,1356,1441,1151,1243,1369,1130,1229,1122,963,900,907,843,895,838,843,829,829,829,829,891,889,1050,1073,1200,1032,1055,1090,862,821,782,735,685,670,651,673,766,898,964,968,844,667,660,602,845,1033,1103,1216,1160,1121,960,995,1090,1287,1284,1233,1315,1356,1151,1166,1073,1079,1134,1263,1003,1135,1103,997,1094,993,863,829,829,829,829,845,841,843,841,841,832,829,0,888,978,1099,898,1004,1125,1003,947,851,793,709,697,738,794,951,1121,1134,909,768,767,739,701,800,902,1139,1193,1377,1213,1150,1211,1312,1113,1197,1008,1169,1246,1103,931,919,1080,1014,1047,915,919,899,899,930,919,903,838,829,829,835,859,863,854,854,848,845,833,889,1087,1075,946,935,824,876,779,755,734,716,711,750,814,1023,1041,1174,1120,903,835,875,887,919,910,1161,1146,1232,1159,1048,1052,1138,1139,1028,961,945,964,1078,961,941,912,899,899,899,899,899,899,907,1011,1145,996,943,920,918,892,870,876,876,868,862,860,862,856,896,884,809,786,773,755,747,737,736,733,730,750,909,923,998,968,1069,1011,974,1021,1067,1051,1064,1029,1185,1043,994,931,976,1213,1157,1102,1014,962,959,998,945,941,931,926,924,916,899,929,1055,1098,1216,1329,1229,1192,1033,943,900,891,895,889,880,870,865,858,847,850,859,799,789,775,758,750,738,749,747,744,737,751,792,871,983,1147,1193,1104,1328,1397,1351,815,996,1236,1146,916,899,952,1029,928,1054,984,1004,973,972,953,949,943,939,937,949,1081,1086,1151,1193,1174,1115,1111,958,916,922,922,915,899,899,881,874,869,856,852,842,829,813,795,782,773,768,766,763,816,811,777,827,910,979,1076,1219,1313,1343,1413,1561,1414,842,982,1200,1186,994,904,913,918,963,964,970,975,978,977,979,971,964,963,1062,1139,1073,1022,1067,986,981,974,971,963,948,941,944,936,925,909,889,877,876,880,868,855,834,821,810,802,795,787,778,776,787,772,886,1038,1152,1088,1136,1326,1424,1476,1463,1507,1321,1057,1124,1020,1130,1138,943,924,948,958,963,968,969,982,993,1003,999,993,1016,1015,997,993,991,994,987,978,979,989,982,961,965,955,953,929,923,916,897,900,899,884,874,856,841,834,823,810,799,797,800,868,875,822,881,923,1014,1111,1237,1308,1262,1239,1296,1286,900,897,912,1037,1087,939,942,950,956,964,975,990,994,1007,1022,1042,1036,1039,1029,1024,1015,1005,999,1005,1007,1013,1008,996,1005,987,982,982,962,953,935,928,924,920,906,890,875,869,849,842,828,817,820,878,935,1083,964,960,966,1067,1195,1141,1140,1153,1148,1149,1213,896,896,896,924,931,942,948,952,959,972,987,1016,1027,1035,1056,1064,1070,1055,1061,1047,1043,1017,1016,1028,1019,1023,1033,1030,1042,1015,1013,1001,994,986,961,954,953,946,923,919,904,896,877,860,843,831,832,922,1080,1097,1070,1018,987,1021,1070,1082,1028,1035,1050,1138,1236,896,896,896,901,915,943,955,966,986,996,1006,1029,1047,1053,1073,1082,1084,1090,1085,1070,1075,1051,1054,1072,1054,1059,1060,1066,1070,1045,1037,1032,1028,1016,1000,986,979,967,957,949,934,922,901,883,869,856,852,915,995,1027,941,937,933,936,946,969,972,996,1036,1125,1154,896,896,896,897,911,931,959,981,998,1015,1015,1065,1068,1082,1094,1107,1101,1121,1116,1110,1101,1108,1111,1106,1110,1107,1103,1099,1093,1081,1073,1074,1073,1052,1031,1005,1005,987,991,973,956,943,935,954,903,887,906,963,989,935,935,936,937,937,946,945,947,954,970,1016,1054,992,1040,1025,901,923,945,988,989,1008,1024,1045,1060,1099,1105,1114,1122,1136,1152,1151,1170,1167,1149,1168,1141,1146,1150,1143,1139,1150,1116,1108,1110,1110,1079,1071,1050,1032,1015,1012,1000,989,973,962,938,933,935,931,956,962,969,962,937,940,939,956,952,949,958,962,983,1072,1334,1396,1179,1090,1077,984,980,996,1030,1046,1073,1101,1142,1144,1132,1147,1176,1192,1192,1207,1215,1230,1239,1195,1211,1208,1193,1189,1196,1162,1160,1144,1131,1117,1095,1082,1062,1054,1041,1031,1021,1005,998,984,968,969,970,973,970,974,970,966,948,955,965,966,951,981,997,1061,1018,1373,1235,1104,1046,957,979,982,987,1007,1033,1084,1112,1165,1194,1332,1289,1248,1253,1245,1252,1258,1279,1270,1268,1266,1259,1254,1237,1246,1209,1193,1190,1167,1145,1130,1102,1098,1091,1082,1064,1056,1052,1037,1017,992,1007,1001,997,993,993,981,973,962,961,959,987,988,1036,1138,1113,1154,1077,1125,971,966,970,985,987,995,1017,1070,1086,1143,1161,1334,1439,1281,1271,1282,1296,1307,1334,1328,1355,1337,1338,1326,1303,1283,1271,1256,1245,1219,1203,1175,1159,1148,1133,1128,1122,1106,1105,1086,1071,1048,1032,1030,1026,1025,1021,1015,1002,996,978,972,969,997,1079,1136,1163,1269,1261,939,1027,1076,969,1001,1010,1018,1034,1064,1074,1088,1128,1145,1196,1281,1273,1267,1289,1325,1371,1386,1410,1416,1396,1392,1372,1349,1317,1305,1303,1290,1259,1246,1224,1198,1192,1175,1169,1163,1151,1148,1129,1112,1091,1074,1066,1057,1052,1051,1036,1019,1000,992,981,1093,1074,1078,1110,1069,1110,1133,943,967,972,973,988,1000,1021,1042,1056,1065,1078,1115,1161,1200,1225,1288,1287,1345,1371,1438,1461,1467,1470,1475,1461,1431,1413,1384,1369,1350,1329,1307,1286,1262,1252,1242,1227,1212,1222,1205,1194,1170,1147,1129,1120,1105,1097,1092,1076,1057,1040,1027,1009,993,990,1001,1010,1005,1014,1053,1048,924,922,927,954,977,990,1013,1033,1061,1074,1085,1128,1180,1210,1260,1300,1438,1385,1436,1487,1526,1537,1546,1541,1509,1501,1481,1456,1438,1406,1372,1351,1326,1309,1308,1297,1281,1274,1268,1257,1247,1215,1199,1182,1157,1149,1139,1122,1106,1078,1060,1048,1016,989,984,984,984,984,984,984,1020,886,899,908,931,977,985,1001,1031,1049,1071,1116,1158,1180,1218,1275,1324,1356,1392,1450,1517,1567,1586,1600,1596,1589,1576,1583,1533,1483,1469,1454,1415,1375,1366,1365,1355,1353,1341,1328,1324,1299,1268,1242,1218,1203,1189,1176,1161,1123,1094,1077,1051,1031,1004,989,984,984,984,984,984,984,872,890,902,932,956,977,1001,1019,1023,1053,1092,1128,1178,1218,1269,1303,1361,1411,1473,1546,1619,1647,1657,1649,1690,1666,1640,1607,1571,1577,1518,1437,1433,1453,1445,1436,1428,1413,1390,1397,1354,1330,1301,1268,1250,1229,1218,1178,1144,1111,1090,1062,1037,1020,1003,989,984,984,984,984,984,880,886,888,918,935,972,969,979,1024,1057,1090,1133,1174,1220,1269,1321,1378,1418,1477,1586,1632,1670,1705,1718,1792,1757,1746,1720,1690,1713,1662,1607,1561,1570,1542,1531,1501,1484,1473,1458,1428,1384,1348,1327,1308,1266,1229,1188,1152,1114,1095,1061,1050,1038,1018,1003,995,984,984,984,984,861,879,899,915,956,934,953,983,1007,1061,1093,1147,1175,1232,1294,1366,1414,1459,1535,1595,1653,1752,1809,1822,1847,1884,1851,1848,1862,1828,1906,1878,1811,1729,1668,1631,1603,1585,1564,1523,1481,1437,1404,1374,1329,1287,1243,1210,1171,1133,1102,1086,1060,1046,1049,1047,1040,1038,1025,1038,1034,851,871,890,903,893,913,940,974,1018,1048,1089,1146,1182,1243,1293,1358,1434,1470,1559,1610,1708,1858,1889,1993,1965,1986,1986,2008,2040,2085,2179,2018,1945,1848,1779,1756,1723,1684,1641,1588,1539,1483,1442,1408,1361,1324,1272,1232,1195,1152,1121,1110,1097,1108,1107,1096,1063,1081,1063,1071,1107,847,867,891,869,883,903,938,972,994,1028,1076,1118,1170,1254,1310,1374,1416,1489,1588,1647,1728,1823,1955,2052,2129,2110,2152,2148,2221,2263,2314,2178,2074,1999,1961,1904,1825,1754,1700,1621,1574,1563,1499,1460,1412,1358,1318,1261,1221,1180,1150,1140,1154,1194,1177,1125,1109,1122,1146,1165,1139,845,866,874,874,890,900,930,957,995,1031,1076,1122,1163,1224,1279,1351,1406,1520,1579,1640,1760,1884,1992,2111,2196,2229,2284,2310,2386,2480,2479,2399,2268,2225,2146,2015,1911,1838,1820,1686,1642,1589,1558,1515,1450,1400,1343,1292,1243,1206,1192,1202,1210,1252,1198,1192,1056,1164,1234,1268,1254,826,847,857,851,857,894,920,946,989,1021,1066,1120,1198,1210,1258,1333,1420,1502,1571,1663,1753,1883,2034,2188,2277,2390,2428,2502,2596,2683,2712,2651,2499,2413,2248,2154,2068,1953,1838,1803,1683,1663,1602,1538,1476,1410,1360,1317,1273,1258,1283,1232,1156,1110,1063,1027,1052,1215,1303,1331,1229,795,814,814,833,838,849,878,919,968,1023,1069,1116,1132,1173,1246,1325,1404,1459,1561,1658,1770,1929,2057,2206,2377,2521,2655,2741,2848,2946,2995,2887,2717,2574,2442,2301,2208,2065,1946,1844,1806,1711,1631,1574,1485,1420,1399,1355,1334,1363,1310,1133,999,942,905,914,1119,1218,1291,1178,973,775,770,781,798,793,813,841,891,930,980,1026,1062,1116,1169,1230,1301,1370,1444,1530,1649,1772,1911,2048,2223,2405,2614,2808,3005,3135,3248,3282,3096,2968,2811,2623,2471,2311,2156,2042,1953,1864,1761,1659,1587,1496,1420,1397,1364,1386,1324,1231,1189,1104,938,857,865,1002,1024,1118,1052,917,742,741,758,760,764,770,813,874,902,938,978,1028,1071,1129,1200,1268,1345,1420,1519,1598,1702,1829,2007,2200,2400,2646,2896,3138,3396,3588,3500,3372,3178,2967,2743,2543,2359,2219,2088,1969,1857,1732,1664,1541,1456,1387,1303,1280,1282,1199,1097,1076,1010,924,858,852,904,931,921,914,920,719,720,717,740,737,738,788,835,866,890,943,989,1039,1098,1156,1237,1324,1441,1565,1579,1673,1801,2009,2168,2393,2657,2919,3177,3500,3684,3703,3510,3227,2979,2757,2562,2377,2217,2071,1953,1832,1722,1619,1511,1422,1343,1272,1215,1159,1104,1057,974,940,901,862,838,823,785,814,781,768,670,684,684,719,723,719,758,793,832,867,907,970,1024,1083,1160,1248,1328,1372,1439,1506,1613,1729,1926,2138,2375,2638,2917,3202,3494,3681,3651,3444,3178,2942,2742,2535,2363,2204,2059,1935,1799,1684,1590,1500,1411,1309,1248,1178,1132,1088,1037,984,945,908,872,828,801,773,771,775,741,658,647,662,670,680,704,736,773,805,845,887,939,1003,1070,1149,1209,1270,1341,1412,1496,1598,1728,1896,2103,2322,2574,2786,3041,3250,3381,3380,3282,3099,2906,2718,2529,2331,2164,2016,1858,1748,1647,1542,1446,1370,1299,1222,1151,1106,1064,1023,981,939,902,866,836,807,791,760,735,717,684,629,640,644,668,690,722,747,789,827,859,924,994,1058,1129,1185,1222,1299,1390,1472,1581,1727,1868,2028,2202,2392,2603,2791,2952,3034,3079,3022,2857,2789,2624,2453,2270,2099,1961,1827,1710,1597,1516,1433,1360,1270,1216,1166,1109,1065,1003,971,927,892,862,835,806,782,755,725,708,667,612,602,626,650,681,710,743,769,808,843,895,963,1026,1081,1158,1205,1277,1358,1450,1563,1671,1809,1939,2071,2212,2398,2539,2672,2719,2766,2745,2542,2530,2638,2445,2238,2059,1889,1781,1667,1566,1474,1393,1329,1271,1210,1140,1099,1054,1019,973,923,892,872,831,803,772,740,719,690,619,595,596,618,637,666,690,708,733,765,812,872,921,989,1043,1107,1159,1240,1312,1407,1499,1573,1702,1830,1948,2062,2200,2309,2414,2439,2491,2493,2453,2384,2426,2321,2149,1978,1868,1755,1663,1574,1485,1391,1309,1249,1193,1125,1085,1033,988,959,904,876,833,823,799,756,724,699,679,581,581,588,600,617,636,654,685,705,750,782,829,888,955,994,1065,1119,1192,1273,1353,1404,1460,1557,1688,1800,1869,1996,2077,2106,2163,2269,2245,2231,2241,2196,2153,1998,1890,1893,1782,1647,1566,1462,1384,1305,1248,1186,1123,1068,1004,961,928,891,855,821,789,773,747,709,693,677,566,554,566,579,591,602,630,654,691,725,746,796,845,905,965,1012,1084,1146,1221,1280,1346,1403,1460,1579,1689,1740,1809,1883,1880,1993,2093,2064,2021,2058,2064,1955,1902,1786,1746,1670,1615,1529,1448,1351,1270,1213,1168,1114,1087,1006,934,905,863,831,803,772,747,727,697,673,662,560,524,545,555,563,584,598,629,658,682,731,776,830,890,932,983,1037,1103,1176,1237,1300,1341,1397,1490,1575,1673,1667,1733,1789,1847,1876,1878,1878,1891,1880,1848,1786,1696,1645,1556,1514,1464,1392,1325,1260,1180,1129,1083,1036,996,943,892,848,808,783,757,734,714,691,664,643,533,514,536,526,537,560,573,604,621,654,714,748,790,833,904,945,1003,1063,1128,1188,1234,1292,1386,1424,1489,1576,1633,1690,1727,1722,1695,1710,1745,1745,1734,1737,1703,1641,1588,1486,1430,1364,1331,1285,1216,1194,1083,1046,995,954,912,868,822,777,753,737,709,697,673,658,641,528,492,496,504,507,521,544,563,590,628,670,713,757,812,849,907,947,1013,1046,1105,1173,1243,1300,1340,1414,1508,1563,1617,1648,1607,1606,1610,1676,1653,1649,1626,1600,1551,1504,1446,1390,1337,1279,1233,1176,1143,1081,1029,987,942,899,855,815,782,744,720,703,689,666,649,626,524,464,470,480,488,502,516,548,567,603,647,683,729,764,815,863,898,940,982,1032,1108,1180,1241,1283,1344,1411,1446,1480,1464,1480,1474,1493,1548,1578,1562,1536,1494,1487,1458,1408,1353,1315,1245,1182,1149,1103,1070,1026,986,915,885,835,806,769,741,719,682,654,639,631,613,493,453,447,461,470,478,505,526,535,560,607,633,686,711,760,801,838,884,928,975,1055,1111,1169,1205,1247,1286,1336,1350,1356,1363,1389,1419,1467,1496,1500,1484,1454,1473,1442,1420,1320,1278,1231,1165,1112,1057,1038,1024,969,913,851,807,793,764,734,708,685,650,612,590,584,435,421,431,435,436,442,460,486,509,533,539,601,655,691,722,756,795,839,871,932,1003,1046,1090,1134,1194,1250,1284,1264,1250,1274,1313,1346,1368,1401,1427,1427,1427,1421,1368,1310,1259,1229,1175,1138,1084,1033,1009,963,973,895,826,795,769,753,730,697,675,650,630,594,567,389,421,403,397,406,426,444,452,470,499,529,569,607,663,694,695,721,773,820,871,913,953,1017,1059,1112,1170,1208,1213,1190,1204,1230,1277,1309,1347,1362,1358,1378,1374,1339,1276,1230,1171,1128,1083,1054,1019,978,929,895,846,817,788,768,752,704,686,653,627,596,577,558,370,376,394,363,373,389,405,415,431,473,505,549,579,641,631,634,654,703,753,831,869,911,959,995,1052,1099,1110,1121,1142,1147,1166,1200,1233,1256,1274,1281,1284,1279,1255,1219,1273,1253,1077,1058,1039,1009,958,915,888,853,812,783,755,736,709,668,637,610,582,561,548,343,349,386,342,345,357,368,383,409,476,506,546,573,591,565,596,620,679,719,789,811,848,900,921,990,1036,1057,1074,1085,1089,1110,1147,1168,1168,1186,1201,1198,1184,1170,1140,1143,1100,1031,1045,1055,989,944,904,873,841,810,776,741,713,699,664,633,603,591,562,535,323,330,354,324,328,333,349,376,399,425,503,492,472,508,533,546,571,629,690,744,755,777,822,872,926,975,1017,1023,1026,1024,1046,1073,1096,1104,1106,1118,1116,1115,1108,1085,1079,1046,1015,1018,1027,969,931,893,865,824,809,777,732,711,685,656,614,591,570,553,523,304,297,298,285,301,317,324,324,367,373,398,413,447,473,495,525,574,599,646,676,705,730,776,815,866,901,940,952,957,947,968,993,1010,1038,1047,1059,1062,1067,1058,1020,1000,1021,979,960,956,941,912,880,842,810,775,760,727,699,675,641,622,576,552,542,521,305,265,256,262,278,287,293,298,314,317,351,373,400,417,460,521,539,546,586,612,661,699,733,761,816,840,863,868,890,882,901,933,943,962,986,988,1006,1010,997,971,972,975,961,952,922,901,891,868,828,798,758,729,704,676,635,625,601,554,525,516,500,300,228,241,234,244,254,258,275,275,304,327,351,375,411,437,473,498,536,541,569,606,665,681,723,731,773,775,797,824,840,845,874,899,899,919,939,951,959,957,938,936,936,923,924,904,889,859,839,822,781,745,713,685,656,621,588,569,540,516,490,478,235,205,210,222,234,228,235,253,274,295,308,320,341,367,383,439,454,501,536,563,605,635,632,662,683,698,718,736,763,779,796,825,846,867,874,893,904,916,914,903,888,900,893,895,885,872,862,840,812,780,739,674,643,636,602,563,545,514,504,475,467,221,188,188,183,215,212,224,240,258,271,283,303,325,343,339,385,418,467,502,528,551,568,577,611,639,650,665,690,725,745,757,798,806,816,838,857,863,866,869,876,896,920,936,902,918,958,971,993,894,729,713,648,609,583,563,559,538,509,481,471,444,290,174,169,173,193,198,208,220,235,249,263,284,290,313,344,387,395,425,459,483,498,525,529,534,581,604,632,649,674,700,705,734,759,789,798,813,809,840,841,864,919,1051,1043,1009,996,1047,983,885,756,732,715,651,600,580,556,531,519,498,468,443,427,283,160,157,165,174,176,196,203,214,224,243,272,261,303,311,335,364,384,418,435,465,479,495,507,530,563,597,619,630,637,662,693,720,756,768,783,803,824,853,947,989,1146,1255,1192,1155,1153,972,798,837,781,750,728,629,568,538,518,497,468,463,441,404,294,145,143,143,155,164,174,184,194,199,211,240,243,274,285,305,330,352,385,418,426,444,455,477,490,527,550,579,606,605,614,652,689,727,736,752,781,822,929,1051,1090,1241,1456,1376,1196,1056,869,959,924,937,838,759,700,627,588,520,487,456,428,433,410,275,159,140,140,144,150,157,159,173,171,182,204,232,241,263,290,303,311,350,370,381,411,434,445,463,491,513,528,542,563,595,629,652,667,690,759,814,797,862,1018,1171,1165,1254,1222,1061,960,1003,1141,1134,946,806,723,649,585,542,499,479,430,374,382,384,290,208,131,133,133,131,142,141,151,150,168,181,190,224,241,272,268,289,308,316,354,372,377,415,424,456,479,483,496,528,560,591,612,630,644,735,868,975,989,992,1024,1114,1243,1185,1151,1105,1218,1290,1113,993,831,704,622,618,623,543,487,451,365,373,371,279,241,137,127,124,119,127,132,131,136,146,156,181,188,207,220,234,258,289,299,318,332,346,363,412,401,430,453,460,491,514,547,560,624,696,771,859,938,926,954,992,984,1135,1031,1119,1374,1330,1131,1005,848,771,795,790,728,628,574,517,443,400,381,333,279,222,170,154,131,116,116,120,115,115,122,136,161,163,175,187,214,233,248,264,273,295,309,343,387,403,400,415,424,446,464,479,515,587,661,725,743,729,766,827,869,1128,1155,914,958,1187,1303,1246,1086,1027,880,811,752,720,665,596,538,469,420,394,343,244,151,173,226,158,127,114,109,107,98,103,114,125,140,152,170,195,196,210,228,250,264,286,308,322,344,358,363,365,390,405,417,509,600,581,564,651,799,912,992,983,997,0,883,1107,1296,1185,1114,1093,1077,949,790,666,609,566,577,501,446,401,379,311];